	
function PostBack(sCommand, sArgument, bCheckDelete) {

		//confirm delete if required	
		if (bCheckDelete==true) {
			if (confirm('Are you sure that you want to delete this record?')==false) {
				return;
			}
		}
		
		document.forms[0].Command.value=sCommand;
		document.forms[0].Argument.value=sArgument;
		document.forms[0].submit();
	}

	
	function DoSubscribe () {
	
	var theform;
	var name;
	var from;
	
	//get name and email
	name=document.frm.subname;
	from=document.frm.subfrom;
	
	//validate name 
	if ((name.value==null)||(name.value=="Name")){
		alert("Please Enter your Name");
		name.focus();
		
		return false;
	}
	//email
	if ((from.value==null)||(from.value=="Email")){
		alert("Please Enter your Email address");
		from.focus();
		return false;
	}
	if (echeck(from.value)==false){
		from.value="";
		from.focus();
		return false;
	}
	
	
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.forms["frmSubscribe"];
		theform.name.value=name.value;
		theform.from.value=from.value;
		
	}
	else {
		theform = document.forms["frmSubscribe"];
		theform.name.value=name.value;
		theform.from.value=from.value;
	}
	
	//submit
	theform.submit();
	
	
	}
	
	function echeck(str) {

		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		var strINVALID = "Sorry, the email address entered appears to be invalid.";
		
		if (str.indexOf(at)==-1){
		   alert(strINVALID);
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert(strINVALID);
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert(strINVALID);
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert(strINVALID);
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(strINVALID);
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert(strINVALID);
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert(strINVALID);
		    return false;
		 }

 		 return true;					
	}
	
	function TextboxSubmit(oEvent, sCommand, sArgument) {
		if (oEvent.keyCode == 13) {
			document.forms[0].Command.value=sCommand;
			document.forms[0].Argument.value=sArgument;
			document.forms[0].submit();
			oEvent.cancelBubble = true;
			oEvent.returnValue = false;
			
		}
	}

	function SetFocus(sControlID) {
		var oControl=window.document.getElementById(sControlID);
		if (oControl != null){oControl.focus()};
	}	

	function IntegerOnly(oEvent) {
		return oEvent.keyCode>47 && oEvent.keyCode<58;
	}

	function IntegerMinusOnly(oEvent) {
		return oEvent.keyCode>47 && oEvent.keyCode<58 || oEvent.keyCode==45;
	}
	
	function NumberOnly(oEvent) {
		return (oEvent.keyCode>47 && oEvent.keyCode<58) || (oEvent.keyCode==46 || oEvent.keyCode==45);
	}	
	
	
	function PreLoadImage(sImageSource) {
		oImage = new Image();
		oImage.src = sImageSource;
	}
	
	//Functions to set Css styles
	setStyle = function(obj, style, value) {
		getRef(obj).style[style] = value;
	}      
	getRef = function (obj){
		return (typeof obj == "string") ?
				document.getElementById(obj) : obj;
	}
	
	function ToggleSection(sSection) {
		//oSection=document.getElementById(sSection);
		oSection=GetObjectById(sSection);
		
		if (oSection.style.display=='none') {
			oSection.style.display='';
		} else {
			oSection.style.display='none';
		}
	}
	
	function GetObjectById(sID) {
		if (document.getElementById) {
			return document.getElementById(sID);	
		} else {
			return document.layers[sID];
		}
	}
   function getCookie(name) {
	var oCookie = document.cookie;
    name += "="; 
    var i = 0; 
    
    while (i < oCookie.length) {
      var offset = i + name.length; // end of section to compare with name string
      if (oCookie.substring(i, offset) == name) { // if string matches
        var endstr = oCookie.indexOf(";", offset); // locate end of name=value pair
        if (endstr == -1) endstr = oCookie.length;
        return unescape(oCookie.substring(offset, endstr)); // return cookie value section
      }
      i = oCookie.indexOf(" ", i) + 1; // move i to next name=value pair
      if (i == 0) break; // no more values in cookie string
    }
    return null; // cookie not found
  }
  
function setCookie (name, value) {
  var argv = setCookie.arguments;
  var argc = setCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  
  document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
}  
