  var str = unescape(window.location);
  str = str.substr(str.indexOf("?")+1);
  var obj = str.split(',');
  var p0 = obj[0]; // 
  var p1 = obj[1]; // 
  var p2 = obj[2]; //
  var p3 = obj[3]; // 
  var p4 = obj[4]; // 
  var p5 = obj[5]; // 
  var p6 = obj[6]; // 
  var userName = "Guest";

function IE(e) 
{
     if (navigator.appVersion.indexOf("MSIE")!=-1) 
     {
            if (event.button == "2" || event.button == "3") return false;
//          alert(message); if(closeWin == "1") self.close();
     }
}
function NS(e) 
{
     if (navigator.appName=="Netscape")
     {
          if (e.which == "2" || e.which == "3")  return false;
     }
}

function FX(e) {
	if(navigator.userAgent.indexOf("Firefox")!=-1){
		if (e.which == "2" || e.which == "3")  return false;
	}
}

function OP(e) {
	if(navigator.userAgent.indexOf("Opera")!=-1) {
		if (e.which == "2" || e.which == "3")  return false;
	}
}

document.onmousedown=IE;
document.onmouseup=NS;
document.onmouseup=FX;
document.onmouseup=OP;
document.oncontextmenu=new Function("return false");

String.prototype.trim = function() {
  		return this.replace(/^\s*|\s*$/g, "")
}

function checkEmail(str) {
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  	var isOK = !r1.test(str) && r2.test(str);
	if (!isOK) {
	alert("Email id ("+str+") is invalid\nCheck the format and remove comma at the end if any");
	}
	return isOK;
 }

function checkForm(form) {
	returnVal = true;
	for (i=0; i < form.elements.length; i++) {
		ele = form.elements[i];
		if (ele.name.substr(0, 2)=="x_" && ele.value.trim()=="" ) {
			alert(ele.name.substr(2)+" is required. Please provide a valid value!");
			ele.focus();
			returnVal = false;
			break;
		} 

		if ((ele.name.substr(0, 2)=="x_" || ele.value.trim()!="" ) 
		   && (ele.name.indexOf("email") !=-1))  {
			if ( ele.value.indexOf(",") != -1 ) {
				emails = ele.value.split(",");
				for ( i = 0; i<emails.length; i++) 
					returnVal = checkEmail(emails[i].trim());
			} else returnVal = checkEmail(ele.value.trim());
			if (!returnVal) {
					ele.focus();
					break;
			}
		}
	}
	return returnVal;
}

