function submitURL(hrefurl){
	window.location=hrefurl;
}
function checkEmpty(value) {
	if (value == null || value == "null" || value == "") {
		return true;
	} else {
		return false;
	}
}
function wait(millis) {
	var date = new Date();
	var curDate = null;
	do {
		curDate = new Date();
	} while (curDate - date < millis);
}
function append(originalString, appendString) {
	if (originalString != null && appendString != null) {
		return originalString + appendString;
	} else {
		return appendString;
	}
}
function disableForm(formName) {
	var f = document.forms[formName];
	var limit = f.elements.length;
	for (var i = 0; i < limit; i++) {
		f.elements[i].disabled = true;
	}
}

function enableForm(formName) {
	var f = document.forms[formName];
	var limit = f.elements.length;
	for (var i = 0; i < limit; i++) {
		f.elements[i].disabled = false;
	}
}

function focusButton(butid){
	var elem = document.getElementById(butid);
	if(elem!=null && (elem.type=='button' || elem.type=='submit')){
		elem.focus();
	}
}
function unfocusButton(butid){
	var elem = document.getElementById(butid);
	if(elem!=null && (elem.type=='button' || elem.type=='submit')){
		elem.blur();
	}
}

function submitButtonOnKeyEnter(event, buttonid){
	if ((event.which && event.which == 13) || 
 		   (event.keyCode && event.keyCode == 13)){
    	var butelem = document.getElementById(buttonid);
    	if(butelem!=null){
    		butelem.click();
    	}
    }
}


function validateEmailAddress(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		  // alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    //alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}


