function DotToComma()
{	
	var dotCode = 46;
	var key = window.event.keyCode;
	//NS handling
	if(key == null)
		key = window.event.which;
	var sourceElement = window.event.srcElement.value;
	if(key == dotCode)
	{
		window.event.srcElement.value = window.event.srcElement.value+',';
		window.event.returnValue = false;
	}
}

// WebComponent Object
var WebComponent = 
{
	Collapse: function (targetID, el) 
	{
		var __contentZone	= document.getElementById(targetID + "_ContentZone");
		//var __hiddenField	= document.getElementById("p_" + targetID);
		var __hiddenField	= document.getElementById("fwk_Clp_" + targetID);
		var __czs					= __contentZone.style;		
		if(__czs.display == 'none')
		{
			__czs.display = 'block';
			__hiddenField.value = "False";
			el.className = "cmdCollapse";
		}
		else
		{
			__czs.display = 'none';		
			__hiddenField.value = "True";
			el.className = "cmdExpand";
		}
	},
	Hide: function (targetID) 
	{
		var __contentZone	= document.getElementById(targetID + "_ContentZone");
		var __czs					= __contentZone.style;
		__czs.display = 'none';		
	},
	Confirm: function()
	{
		return window.confirm(_confirmMsg);
	}	
}
var Focus = 
{
	Apply: function(id)
	{
		if(id != null)
		{
		 var tag = document.getElementById(id);
		 if(tag != null) tag.focus();
		}
	},
	DisableEvent: function()
	{
		if (window.navigator.appName.toLowerCase().indexOf('netscape') > -1) 
			return;
		document.attachEvent("onkeydown", OnKeyDown);
		function OnKeyDown()
		{
			var isEnter = (event.keyCode == 13);
			var src = event.srcElement;
			if(isEnter)
			{
				if(src != null && src.tagName == "SELECT")
				{
					return;
				}
				if(src != null && src.tagName == "TEXTAREA")
				{
					return;
				}
				if(src != null && src.tagName == "INPUT" && (src.type == "text" || src.type == "password"))
				{
					//Temporary
					if(src.id == "SignIn_tbxLogin" || src.id == "SignIn_tbxPassword")
					{
						return;					
					}
					else
					{
						return event.returnValue = false;
					}					
				}
				return event.returnValue = false;
			}
		}
	}
}
var ClientNavigation = 
{
	Reset: function()
	{
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf('netscape') > -1) 
		{
			theform = document.forms['fwk_form'];
		}
		else 
		{
			theform = document.fwk_form;
		}
		theform.__CLIENTREQUESTSENDER.value=""; 
		theform.__CLIENTREQUESTACTION.value=""; 
		theform.__CLIENTREQUESTPARAMS.value=""; 	
	},
	CreateParamString: function (name, value)
	{
		return name.concat("|", value);
	}	,
	ConcatParams: function (p1, p2)
	{
		return p1.concat("#", p2);
	}	,
	Submit: function (sender, actionName, paramInfo) 
	{
		var senderID;
		while(sender != null)
		{
			if(sender.className.indexOf("WCmpnt ") == 0)
			{
				senderID = sender.id;
				break;
			}
			sender = sender.parentElement;
		}
		
		var theform;
			if (window.navigator.appName.toLowerCase().indexOf('netscape') > -1) 
			{
				theform = document.forms['fwk_form'];
			}
			else 
			{
				theform = document.fwk_form;
			}
			theform.__CLIENTREQUESTSENDER.value=senderID; 
			theform.__CLIENTREQUESTACTION.value=actionName; 
			theform.__CLIENTREQUESTPARAMS.value=paramInfo; 	
			theform.submit();
	},
	Navigate: function (target)
	{
		ClientSubmit(null, "Navigate", target);
	}	,
	NavigateStartup: function (target)
	{
		ClientSubmit(null, "NavigateStartup", target);
	}	,
	SubmitActionWithOneParam: function (sender, actionName, paramName, paramValue) 
	{
		this.Submit(sender, actionName, this.CreateParamString(paramName, paramValue)); 
	}	,
	SubmitActionWithTwoParams: function (sender, actionName, paramName1, paramValue1, paramName2, paramValue2) 
	{
		var p1 = this.CreateParamString(paramName1, paramValue1)
		var p2 = this.CreateParamString(paramName2, paramValue2)
		
		var params = this.ConcatParams(p1, p2);
		
		this.Submit(sender, actionName, params);
	}
}

function ClientSubmit(sender, actionName, paramInfo) 
{
	ClientNavigation.Submit(sender, actionName, paramInfo);
}
function ClientNavigate(target)
{
	ClientNavigation.Navigate(target);
}
function ClientNavigateStartup(target)
{
	ClientNavigation.NavigateStartup(target);
}
function ClientRequestSingle(sender, actionName, paramName, paramValue) 
{
	ClientNavigation.SubmitActionWithOneParam(sender, actionName, ClientNavigation.CreateParamString(paramName, paramValue)); 
}
function ClientRequestDual(sender, actionName, paramName1, paramValue1, paramName2, paramValue2) 
{
	ClientNavigation.SubmitActionWithTwoParams(sender, actionName, paramName1, paramValue1, paramName2, paramValue2);
}

// Default button enter behavior
var AutoSubmit =
{
    //var registrations;
    
    Register: function(webComponentId, controlId)
    {
        //array containing webComponent/control association
        var webComponentButton;
    },
    
    Run: function(webComponentId)
    {
	    //var targetControlClientId = registration[ ?? ];
	    if(targetControlClientId == null)
		    return; // no submit control associated to webcomponent
		    
	    var submitter = document.getElementById(targetControlClientId);
	    if(submitter!=null) 
		    submitter.click();	
    },   
	EnableEvent: function()
	{
	    // INFO: disable behavior for netscape, check for compatibility
		//if (window.navigator.appName.toLowerCase().indexOf('netscape') > -1) 
		//	return;
		document.attachEvent("onkeydown", OnKeyDown);
		function OnKeyDown()
		{
			var isEnter = (event.keyCode == 13);
			if(isEnter)
			{
			    var src = event.srcElement;
			    // discarding some types of controls
				if(src != null && src.tagName == "SELECT")
					return;
				if(src != null && src.tagName == "TEXTAREA")
					return;
				
				
				
				/*if(src != null && src.tagName == "INPUT" && (src.type == "text" || src.type == "password"))
				{
					//Temporary
					if(src.id == "SignIn_tbxLogin" || src.id == "SignIn_tbxPassword")
					{
						return;					
					}
					else
					{
						return event.returnValue = false;
					}					
				}
				return event.returnValue = false;*/
			}
		}
	}
}


function acceptCG(e)
{

cgelem=document.getElementById('cg2009');
//alert(cgelem);
if(cgelem)
{
if(e.checked==true)
 {
  document.getElementById('cg2009').style.visibility='visible';
 } 
 else 
 {
  document.getElementById('cg2009').style.visibility='hidden';
 }
 }
}
