
function goback()
{
	history.go(-1);
}

function onOnlyNumbers(bDontAllowDec)
{
	var key=window.event.keyCode;
	if (((key >= 48) && (key <= 57)) || (key == 43) || (!bDontAllowDec && (key == 46)))
		window.event.returnValue=true;
	else
		window.event.returnValue=false;
}

function onOnlyNumbersAndLetters()
{
	var key=window.event.keyCode;
	if (((key >= 48) && (key <= 57)) || (key == 32) || (key == 8) || (key == 13) || (key == 37) || (key == 39) || ((key >= 65) && (key <= 90)) || ((key >= 96) && (key <= 105))){
		if((key >= 48) && (key <= 57) && (window.event.shiftLeft || window.event.shiftRight)){
			window.event.returnValue=false;			
			return;
		}
		window.event.returnValue=true;
	}else
		window.event.returnValue=false;
}

function onSetBtnFocus(eSrc,eDest)
{
	if (window.event.keyCode == 9 && window.event.shiftLeft==false){
		window.document.getElementById(eDest).focus();
		window.event.returnValue=false;
	}
}

function onBtnClick(eDest)
{
	if (window.event.keyCode == 9 && window.event.shiftLeft==false){
		window.document.getElementById(eDest).click();
		window.event.returnValue=false;
	}
}

function ValidateChecked(oSrc, args)
{
	if(document.all[oSrc.chkBox].checked == false){
		args.IsValid = false;
		oSrc.scrollIntoView()
	}else
		args.IsValid = true;
}

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}

function onChkClick(oChkBox,strReqValidator)
{
	if(oChkBox.checked)
		eval(strReqValidator).enabled=true
	else{
		eval(strReqValidator).enabled=false
		eval(strReqValidator).style.display="none"
		eval(strReqValidator).isvalid="true"
	}
}

//AJAX Code common functions and variables
var xmlHttp; 
var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; 
var is_ie5 = (navigator.appVersion.indexOf("MSIE 5.5")!=-1) ? 1 : 0; 
var is_opera = ((navigator.userAgent.indexOf("Opera6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1)) ? 1 : 0; 
var is_netscape = (navigator.userAgent.indexOf('Netscape') >= 0) ? 1 : 0; 

function get_data(strReqURL, bAsync){ 
    //Append the name to search for to the requestURL 
    var url = strReqURL; 
        
    //Create the xmlHttp object to use in the request 
    //stateChangeHandler will fire when the state has changed, i.e. data is received back 
    // This is non-blocking (asynchronous) 
    if(bAsync)
		xmlHttp = GetXmlHttpObject(stateChangeHandler); 
	else
		xmlHttp = GetXmlHttpObject();
        
    //Send the xmlHttp get to the specified url 
    xmlHttp.open('GET', url, bAsync); 
	xmlHttp.send(null);
	if(!bAsync)
		return xmlHttp.responseText;
} 

//stateChangeHandler will fire when the state has changed, i.e. data is received back 
// This is non-blocking (asynchronous) 
function stateChangeHandler() 
{ 
    //readyState of 4 or 'complete' represents that data has been returned 
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete'){ 
        //Gather the results from the callback 
        var str = xmlHttp.responseText; 

        //Populate the innerHTML of the div with the results 
        document.getElementById('nameList').innerHTML = str; 
    } 
} 

function GetXmlHttpObject(handler) { 
    var objXmlHttp = null;    //Holds the local xmlHTTP object instance 

    //Depending on the browser, try to create the xmlHttp object 
    if (is_ie){ 
        //The object to create depends on version of IE 
        //If it isn't ie5, then default to the Msxml2.XMLHTTP object 
        var strObjName = (is_ie5) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP'; 
            
        //Attempt to create the object 
        try{ 
            objXmlHttp = new ActiveXObject(strObjName); 
            if(handler)
				objXmlHttp.onreadystatechange = handler; 
        } 
        catch(e){ 
        //Object creation errored 
            //alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled'); 
            return; 
        } 
    } 
    else if (is_opera){ 
        //Opera has some issues with xmlHttp object functionality 
        //alert('Opera detected. The page may not behave as expected.'); 
        return; 
    } 
    else{ 
        // Mozilla | Netscape | Safari 
        objXmlHttp = new XMLHttpRequest(); 
        if(handler){
			objXmlHttp.onload = handler; 
			objXmlHttp.onerror = handler; 
		}
    } 
        
    //Return the instantiated object 
    return objXmlHttp; 
} 

function IsEmailValid(strEmailAddress)
{
var at="@"
var dot="."
var lat=strEmailAddress.indexOf(at)
var lstrEmailAddress=strEmailAddress.length
var ldot=strEmailAddress.indexOf(dot)
if (strEmailAddress.indexOf(at)==-1){
	return false
}

if (strEmailAddress.indexOf(at)==-1 || strEmailAddress.indexOf(at)==0 || strEmailAddress.indexOf(at)==lstrEmailAddress){
	return false
}

if (strEmailAddress.indexOf(dot)==-1 || strEmailAddress.indexOf(dot)==0 || strEmailAddress.indexOf(dot)==lstrEmailAddress){
	return false
}

	if (strEmailAddress.indexOf(at,(lat+1))!=-1){
	return false
	}

	if (strEmailAddress.substring(lat-1,lat)==dot || strEmailAddress.substring(lat+1,lat+2)==dot){
	return false
	}

	if (strEmailAddress.indexOf(dot,(lat+2))==-1){
	return false
	}

	if (strEmailAddress.indexOf(" ")!=-1){
	return false
	}

 	return true		
}


