	var request = false;
	
		
		function fnGetRequest()
		{		
			request = false;
			if (window.XMLHttpRequest)
			{
				request = new XMLHttpRequest();
				if (request.overrideMimeType)
				{
					request.overrideMimeType("text/xml");
				}
			}
			else if (window.ActiveXObject)
			{
				try 
				{
					request = new ActiveXObject("Maxml2.XMLHttp");
				}
				catch (e)
				{
					try
					{
						request = new ActiveXObject("Microsoft.XMLHttp");
					}
					catch(e)
					{
					}
				}							
			}
			if (!request)
			{
				var message = "Cannot crate an XMLHTTP Instance.";	window.open("AlertMsg.jsp?status=failure&formname=no&fieldname=no&message="+message+"","WAMS","top=250,left=400,toolbar=no,width=340,height=100,resizeable=no,scrollbars=no,titlebar=no,statusbar=no");
				return false;
			}
			return request;
		}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// For validating the alphabets, Returns true if the string is alphabets

function isAlphabetic(val)
{
	if (val.match(/^[a-zA-Z_.-]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}

// For validating the is alpha numeric. Returns true if the string is alphanumeric

function isAlpha(val)
{
	if (val.match(/^[a-zA-Z0-9_'*. -]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}


function isAlphaFirstLetter(val)
{
	if (val.match(/^[a-zA-Z]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}


//For validating address
function isAddress(val)
{
	if (val.match(/^[a-zA-Z0-9_',. #-]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}

//For validating address
function isStreet(val)
{
	if (val.match(/^[a-zA-Z0-9_',#-. -]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}

// For validating the is alpha numeric. Returns true if the string is alphanumeric

function isAlphaNumeric(val)
{
	if (val.match(/^[a-zA-Z0-9_. -]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}

// For validating the is alpha numeric. Returns true if the string is alphanumeric and no spaces in the val
function isAlphaNumericns(val)
{
	if (val.match(/^[a-zA-Z0-9_.-]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}

// For validating the is alpha numeric. Returns true if the string is alphanumeric and accepts *
function isAlphaNumericsp(val)
{
	if (val.match(/^[a-zA-Z0-9_*. -]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}


function isAlphaEndLetter(val)
{
	if (val.match(/^[a-zA-Z0-9]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}





// For validating the Numeric.  Returns true if the string is Numeric

function isNumeric(val)
{
	if (val.match(/^[0-9]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function verifyIP (IPvalue)
{
	errorString = "";
	theName = "IPaddress";

	var ipPattern = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
	var ipArray = IPvalue.match(ipPattern);

	if (IPvalue == "0.0.0.0")
	errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.';
	else if (IPvalue == "255.255.255.255")
	errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.';
	if (ipArray == null)
	errorString = errorString + theName + ': '+IPvalue+' is not a valid IP address.';
	else
	{
		for (i = 0; i < 4; i++)
		{
			thisSegment = ipArray[i];
			if (thisSegment > 255)
			{
				errorString = errorString + theName + ': '+IPvalue+' is not a valid IP address.';
				i = 4;
			}
			if ((i == 0) && (thisSegment > 255))
			{
				errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.';
				i = 4;
			}
	   }
	}
	extensionLength = 3;

	return errorString;
}

function isNumericValues(val)
{
	if (val.match(/^[0-9- ()]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}


 function isValidMailId(mailId)
	{

		if (/^\w+(([\.-]?\w+)*)@[^+.,*&^%$#@ ~!)(_-]\w+([\.-]?\w+)*[^_-](\.\w{2,3})+$/.test(mailId))
	 		return true;
		return false;

	}

	//For validating Company URL
	function isValidURL(companyUrl)
	{
		var idvalue = companyUrl;
		var idlength = idvalue.length;
		var space= /\s/g;
		var status1 =idvalue.match(space);
		var str=new RegExp("[@]","g");
		var status2=idvalue.match(str);
		if(status2==null)
		{
			var len=0;
		}

		if(status1==-1 || len>1 || len==0 || idvalue.substring(0,2)!="www" || idvalue.substring(idlength-4,idlength)!=".inc" || idvalue.substring(idlength-4,idlength)!=".com"|| idvalue.substring(idlength-4,idlength)!=".in" || idvalue.substring(idlength-4,idlength)!=".org")
		{
			return false;
		}
		else
		{
			return true;
		}
	}

function isValidIPAddress(ipaddr)
{
   var re = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
   if (re.test(ipaddr))
   {
      var parts = ipaddr.split(".");
      if (parseInt(parseFloat(parts[0])) == 0)
	  {
		  return false;
	  }
      for (var i=0; i<parts.length; i++)
	  {
         if (parseInt(parseFloat(parts[i])) > 255)
	     {
			 return false;
		 }
      }
      return true;
   }
   else
   {
	 return false;
   }
}

function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function

	function PrintThisPage()
	{

		var sOption="toolbar=no,location=no,directories=yes,menubar=yes,";
		sOption+="scrollbars=yes,width=675,height=550,left=100,top=25";
		var replacedTabWidth = /width=795/;
		var rep=/javascript:PrintThisPage()/;
		var sWinHTML = document.getElementById('contentstart').innerHTML;
		sWinHTML = sWinHTML.replace(replacedTabWidth,"width=550");
		sWinHTML = sWinHTML.replace(replacedTabWidth,"width=550");
		sWinHTML = sWinHTML.replace(rep,"javascript:window.print");
		var winprint=window.open("","",sOption);
		winprint.document.open();
		winprint.document.write('<html><LINK href="streamclear.css" rel="stylesheet" type="text/css"><body>');
		winprint.document.write(sWinHTML);
		winprint.document.write('</body></html>');
		winprint.document.close();
	    winprint.focus();
	}


	function PrintDeals()
	{

		var sOption="toolbar=no,location=no,directories=yes,menubar=yes,";
		sOption+="scrollbars=yes,width=850,height=450,left=100,top=25";
		var replacedTabWidth = /width=89%/;
		var rep=/javascript:PrintDeals()/;
		var sWinHTML = document.getElementById('contentstart').innerHTML;
		sWinHTML = sWinHTML.replace(replacedTabWidth,"width=1000");
		//sWinHTML = sWinHTML.replace(replacedTabWidth,"width=1");
		sWinHTML = sWinHTML.replace(rep,"javascript:window.print()");
		var winprint=window.open("","",sOption);
		winprint.document.open();
		winprint.document.write('<html><LINK href="streamclear.css" rel="stylesheet" type="text/css"><body>');
		winprint.document.write(sWinHTML);
		winprint.document.write('</body></html>');
		winprint.document.close();
	    winprint.focus();
	}


// getAnchorPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}




// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
	var coordinates=getAnchorPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}




// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}





// For validating the time field. ex)12:00:00

function isTime(val)
{
	if (val.match(/^((0?[0-9])|(1[0-9])|(2[0-3]))(:[0-5][0-9])?(:[0-5][0-9])?$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function printTranscaction()
{
	window.print();
	window.close();
}


// For the checnking multiple checkbox in the role page

function disableAllGeneral()
{
	if(document.forms[1].general[0].checked)
	{
		for(i=0;i<document.forms[1].general.length;i++)
		{
			if(document.forms[1].general[i].type=="checkbox")
			{
				document.forms[1].general[i].checked=true;
				document.forms[1].general[i].disabled=true;
			}
		}
		document.forms[1].general[0].checked=true;
		document.forms[1].general[0].disabled=false;
	}else{
	for(i=0;i<document.forms[1].general.length;i++)
		{
			if(document.forms[1].general[i].type=="checkbox")
			{
				document.forms[1].general[i].checked=false;
				document.forms[1].general[i].disabled=false;
			}
		}
	}
}

function disableGeneral()
{

	if(document.forms[1].general[0] != null) {
		for(i=1;i<document.forms[1].general.length;i++)
		{
			document.forms[1].general[i].checked=true;
			document.forms[1].general[i].disabled=true;
		}
		document.forms[1].general[0].checked=true;
	}
}
function enableAllGeneral()
{
	if(document.forms[1].general[0].checked)
	{
		for(i=0;i<document.forms[1].general.length;i++)
		{
			if(document.forms[1].general[i].type=="checkbox")
			{
				if(document.forms[1].general[i].disabled){
				document.forms[1].general[i].disabled=false;
				}
			}
		}
	}
}


function checkAllGeneral()
{

		for(i=0;i<document.forms[1].general.length;i++)
		{

			if(document.forms[1].general[i].type=="checkbox")
			{
				document.forms[1].general[i].checked=true;
				document.forms[1].general[i].disabled=true;
			}
		}


}

function checkGeneral()
{
	var flag = 0;
	if(document.forms[1].general[0] != null) {
		for(i=1;i<document.forms[1].general.length;i++)
		{
			if(document.forms[1].general[i].checked==true)
			{
				flag += 1;
			}
		}

		if(flag == document.forms[1].general.length-1)
		{
			document.forms[1].general[0].checked=true;
		}
		else
		{
			document.forms[1].general[0].checked=false;
		}
	}
}


function checkAllAdmin()
{
	if(document.forms[1].admin[0].checked)
	{
		for(i=0;i<document.forms[1].admin.length;i++)
		{

			if(document.forms[1].admin[i].type=="checkbox")
			{
				document.forms[1].admin[i].checked=true;
			}
		}
	}
	else
	{
		for(i=0;i<document.forms[1].admin.length-1;i++)
		{

			if(document.forms[1].admin[i].type=="checkbox")
			{
				document.forms[1].admin[i+1].checked=false;
			}
		}
	}


}

function checkAdmin()
{
	var flag = 0;
	if(document.forms[1].admin[0] != null) {
		for(i=1;i<document.forms[1].admin.length;i++)
		{

				if(document.forms[1].admin[i].checked == true)
				{
					flag += 1;
				}
		}
		if(flag == document.forms[1].admin.length-1)
		{
			document.forms[1].admin[0].checked=true;
		}
		else
		{
			document.forms[1].admin[0].checked=false;
		}
	}
}


function checkAllSystem()
{
	if(document.forms[1].system[0].checked)
	{
		for(i=0;i<document.forms[1].system.length;i++)
		{

			if(document.forms[1].system[i].type=="checkbox")
			{
				document.forms[1].system[i].checked=true;
			}
		}
	}
	else
	{
		for(i=0;i<document.forms[1].system.length-1;i++)
		{

			if(document.forms[1].system[i].type=="checkbox")
			{
				document.forms[1].system[i+1].checked=false;
			}
		}
	}


}

function checkSystem()
{
	var flag = 0;
	if(document.forms[1].system[0] != null) {
		for(i=1;i<document.forms[1].system.length;i++)
		{
			if(document.forms[1].system[i].checked==true)
			{
				flag += 1;
			}
		}

		if(flag == document.forms[1].system.length-1)
		{
			document.forms[1].system[0].checked=true;
		}
		else
		{
			document.forms[1].system[0].checked=false;
		}
	}
}

function checkAllCampaign()
{
	if(document.forms[1].campaign[0].checked)
	{
		for(i=0;i<document.forms[1].campaign.length;i++)
		{

			if(document.forms[1].campaign[i].type=="checkbox")
			{
				document.forms[1].campaign[i].checked=true;
			}
		}
	}
	else
	{
		for(i=0;i<document.forms[1].campaign.length-1;i++)
		{

			if(document.forms[1].campaign[i].type=="checkbox")
			{
				document.forms[1].campaign[i+1].checked=false;
			}
		}
	}


}

function checkCampaign()
{
	var flag = 0;
	if(document.forms[1].campaign[0] != null) {
		for(i=1;i<document.forms[1].campaign.length;i++)
		{

				if(document.forms[1].campaign[i].checked==true)
				{
					flag += 1;
				}
		}

		if(flag == document.forms[1].campaign.length-1)
		{
			document.forms[1].campaign[0].checked=true;
		}
		else
		{
			document.forms[1].campaign[0].checked=false;
		}
	}
}

function checkAllReport()
{
	if(document.forms[1].report[0].checked)
	{
		for(i=0;i<document.forms[1].report.length;i++)
		{

			if(document.forms[1].report[i].type=="checkbox")
			{
				document.forms[1].report[i].checked=true;
			}
		}
	}
	else
	{
		for(i=0;i<document.forms[1].report.length-1;i++)
		{

			if(document.forms[1].report[i].type=="checkbox")
			{
				document.forms[1].report[i+1].checked=false;
			}
		}
	}

}

function checkReport()
{
	var flag = 0;
	if(document.forms[1].report[0] != null) {
		for(i=1;i<document.forms[1].report.length;i++)
		{

				if(document.forms[1].report[i].checked==true)
				{
					flag += 1;
				}
		}

		if(flag == document.forms[1].report.length-1)
		{
			document.forms[1].report[0].checked=true;
		}
		else
		{
			document.forms[1].report[0].checked=false;
		}
	}
}

function checkAllMember()
{
	if(document.forms[1].member[0].checked)
	{
		for(i=0;i<document.forms[1].member.length;i++)
		{

			if(document.forms[1].member[i].type=="checkbox")
			{
				document.forms[1].member[i].checked=true;
			}
		}
	}
	else
	{
		for(i=0;i<document.forms[1].member.length-1;i++)
		{

			if(document.forms[1].member[i].type=="checkbox")
			{
				document.forms[1].member[i+1].checked=false;
			}
		}
	}

}
function checkMember()
{
	var flag = 0;
	if(document.forms[1].member[0] != null) {
		for(i=1;i<document.forms[1].member.length;i++)
		{

				if(document.forms[1].member[i].checked==true)
				{
					flag += 1;
				}
		}

		if(flag == document.forms[1].member.length-1)
		{
			document.forms[1].member[0].checked=true;
		}
		else
		{
			document.forms[1].member[0].checked=false;
		}
	}
}
function checkAllSupport()
{
	if(document.forms[1].support[0].checked)
	{
		for(i=0;i<document.forms[1].support.length;i++)
		{

			if(document.forms[1].support[i].type=="checkbox")
			{
				document.forms[1].support[i].checked=true;
			}
		}
	}
	else
	{
		for(i=0;i<document.forms[1].support.length-1;i++)
		{

			if(document.forms[1].support[i].type=="checkbox")
			{
				document.forms[1].support[i+1].checked=false;
			}
		}
	}

}

function checkSupport()
{
	var flag = 0;
	if(document.forms[1].support[0] != null) {
		for(i=1;i<document.forms[1].support.length;i++)
		{

				if(document.forms[1].support[i].checked==true)
				{
					flag += 1;
				}
		}

		if(flag == document.forms[1].support.length-1)
		{
			document.forms[1].support[0].checked=true;
		}
		else
		{
			document.forms[1].support[0].checked=false;
		}
	}
}


function alphaNumericsOnly(val)
{
	if (val.match(/^[a-zA-Z0-9]+$/))
	{
		return true;
	}
	else
	{
		return false;
	}
}

/*
	This function invoked to check for enter key press,
	when enterkey pressed it will submit the form
*/
function validateKey() {
	var key;
	if(window.event)
		key	=	window.event.keyCode;
	else
		key.which;
    if(key == 13)
		fnSubmit();

}

 /*
* This function is used to validate max length of Text Area
*/
function textAreaInstructionCounter(e, field, maxlimit ) {
	var localField = field.value;
	if(window.event) // IE
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	}

	if(fnIsNavigateKey(keynum))
	{
		return true;
	}

	if(keynum != 8 && keynum != 46){
		if(field.value.length == maxlimit && document.selection.createRange().text.length <= 0) {
			field.value = localField;
		return false;
	}
	}



	if ( field.value.length > maxlimit){
		field.value = field.value.substring( 0, maxlimit );
	   alert('Please enter Instruction of maximum '+maxlimit+' characters.');
	return false;

	}
}


function textAreaShortDescriptionCounter(e, field, maxlimit ) {
	var localField = field.value;
	if(window.event) // IE
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	}

	if(fnIsNavigateKey(keynum))
	{
		return true;
	}

	if(keynum != 8 && keynum != 46){
		if(field.value.length == maxlimit && document.selection.createRange().text.length <= 0) {
			field.value = localField;
		return false;
	}
	}



	if ( field.value.length > maxlimit){
		field.value = field.value.substring( 0, maxlimit );
	   alert('Please enter Short Description of maximum '+maxlimit+' characters.');
	return false;

	}
}

/*
* This function is used to validate max length of Text Area
*/
function txDescriptionCounter(e, field, maxlimit ) {
	var localField = field.value;
	if(window.event) // IE
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	}

	if(fnIsNavigateKey(keynum))
	{
		return true;
	}

	if(keynum != 8 && keynum != 46){
		if(field.value.length == maxlimit && document.selection.createRange().text.length <= 0) {
			field.value = localField;
		return false;
	}
	}



	if ( field.value.length > maxlimit){
		field.value = field.value.substring( 0, maxlimit );
	   alert('Transaction Description should not exceed '+maxlimit+' characters');
	e.returnValue = false;

	}
}

// Check for the navigation key
function fnIsNavigateKey(keynum){
	if(keynum == 0 || keynum == 35 || keynum == 36 || keynum == 37 || keynum == 38 || keynum == 39 || keynum == 40 || keynum == 45) {
		return true;
	} else {
		return false;
	}
}


/*
* sdate - Start Date of the format mm/dd/yyyy
* edate - End Date of the format mm/dd/yyyy
*/
function fnCheckDate(sdate,edate)
{
	var start = new Array(3);
	var end = new Array(3);
	//alert(edate)
	start = sdate.split("/");
	var startmonth = start[0];
	var startdate = start[1];
	var startyear = start[2];

	end = edate.split("/");
	var endmonth = end[0];
	var enddate = end[1];
	var endyear = end[2];

	var today = new Date();
	//alert(today)
	var givenstartdate = new Date(startyear,startmonth-1,startdate);
	var givenenddate = new Date(endyear,endmonth-1,enddate);

	if (sdate == "")
	{
		var message = "Please enter the Start Date.";
		alert(message)
		return false;
	}
	else if (edate == "")
	{
		var message = "Please enter the End Date.";
		alert(message)
		return false;
	}
	else if (givenstartdate > today)
	{
		var message = "Please enter a start date prior to today's date.";
		alert(message)
		return false;
	}
	else if (givenenddate > today)
	{
		var message = "Please enter an end date that does not exceed today's date.";
		alert(message)
		return false;
	}
	else if ( sdate <= "0")
	{
		var message = "Please enter a valid Start Date.";
		alert(message)
		return false;
	}

	else if(givenenddate < givenstartdate)
	{
		var message = "Please ensure that the Start Date is prior to the End Date.";
		alert(message)
		return false;
	}
	else
	{
		return true;
	}
}

function fnCheckStartdate(sdate)
{
	var start = new Array(3);
	start = sdate.split("/");
	var startmonth = start[0];
	var startdate = start[1];
	var startyear = start[2];
	var today = new Date();
	var givenstartdate = new Date(startyear,startmonth-1,startdate);

	if (sdate == "")
	{
		var message = "Please enter the Start Date.";
		alert(message)
		return false;
	}
	else if (givenstartdate > today)
	{
		var message = "Please enter a start date prior to today's date.";
		alert(message)
		return false;
	}

	else if ( sdate <= "0")
	{
		var message = "Please enter a valid Start Date.";
		alert(message)
		return false;
	}
	else
	{
		return true;
	}
}
function fnCheckEnddate(edate)
{
	var end = new Array(3);

	end = edate.split("/");
	var endmonth = end[0];
	var enddate = end[1];
	var endyear = end[2];
	var today = new Date();
	var givenenddate = new Date(endyear,endmonth-1,enddate);

	if (edate == "")
	{
		var message = "Please enter the End Date.";
		alert(message)
		return false;
	}
	else if (givenenddate > today)
	{
		var message = "Please enter an end date that does not exceed today's date.";
		alert(message)
		return false;
	}

	else
	{
		return true;
	}
}

function fnCheckstartdateRanges(sdate,edate){

	var start = new Array(3);
	var end = new Array(3);
	start = sdate.split("/");
	var startmonth = start[0];
	var startdate = start[1];
	var startyear = start[2];

	end = edate.split("/");
	var endmonth = end[0];
	var enddate = end[1];
	var endyear = end[2];

	var today = new Date();
	var givenstartdate = new Date(startyear,startmonth-1,startdate);
	var givenenddate = new Date(endyear,endmonth-1,enddate);

	if(givenenddate < givenstartdate)
	{
		var message = "Please ensure that the Start Date is prior to the End Date.";
		alert(message)
		return false;
	}
}
function fnCheckenddateRanges(sdate,edate){

	var start = new Array(3);
	var end = new Array(3);
	start = sdate.split("/");
	var startmonth = start[0];
	var startdate = start[1];
	var startyear = start[2];

	end = edate.split("/");
	var endmonth = end[0];
	var enddate = end[1];
	var endyear = end[2];

	var today = new Date();
	var givenstartdate = new Date(startyear,startmonth-1,startdate);
	var givenenddate = new Date(endyear,endmonth-1,enddate);

	if(givenenddate < givenstartdate)
	{
		var message = "Please ensure that the Start Date is prior to the End Date.";
		alert(message)
		return false;
	}
}

// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=9999;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   }
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1,pos2+5)
	strYr=strYear

	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : dd/mm/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0){
		alert("Please enter a valid 4 digit year")
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
}

function isCampaignDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1,pos2+5)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1;i<= 3;i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)

	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter valid date")
		return false
	}
	if (strYear.length != 4 || year==0){
		alert("Please enter valid 4 digit year")
		return false
	}
	var tempDate = dtStr.substring(0,10);

	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(tempDate, dtCh))==false){
		alert("Please enter valid date")
		return false
	}
	var temp1 = dtStr.substring(10,11);
	if(temp1!=" "){
		alert("Please enter valid date");
		return false;
	}

	/*
	var tempHour = dtStr.substring(11,13);
	var tempSepartor = dtStr.substring(13,14);
	var tempMinute = dtStr.substring(14,16);
	if(!isNumericValues(tempHour)){
		alert("Please enter valid time");
		return false;
	}
	if(tempSepartor!=":") {
		alert("Please enter valid time");
		return false;
	}
	if(!isNumericValues(tempMinute)){
		alert("Please enter valid time");
		return false;
	}
	*/

return true
}

// Removes Starting whitespaces
function LeftTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}
// Removes ending whitespaces
function RightTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}
// Removes leading and ending whitespaces
function trimtext( value ) {
	return LeftTrim(RightTrim(value));
}

function disableFormElements(){
	var numberForms = document.forms[1].length;
 	for(x=0;x<document.forms[1].length;x++)
	{
		document.forms[1].elements[x].disabled=true;
	}
}


function enableFormElements(){
	var numberForms = document.forms[1].length;
 	for(x=0;x<document.forms[1].length;x++)
	{
		document.forms[1].elements[x].disabled=false;
	}
}
function clearFormElements(){
	var numberForms = document.forms[1].length;
 	for(x=0;x<document.forms[1].length;x++)
	{
		document.forms[1].elements[x].disabled=false;
	}
}
// Removes starting whitespaces
 function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}
// Removes ending whitespaces
function RTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}
// Removes leading and ending whitespaces
function trim( value ) {
	return LTrim(RTrim(value));
}

//Moneyvalidation
function moneyFormat(textObj) {
   var newValue = textObj.value;
   var decAmount = "";
   var dolAmount = "";
   var decFlag = false;
   var aChar = "";

   // ignore all but digits and decimal points.
   for(i=0; i < newValue.length; i++) {
      aChar = newValue.substring(i,i+1);
      if(aChar >= "0" && aChar <= "9") {
         if(decFlag) {
            decAmount = "" + decAmount + aChar;
         }
         else {
            dolAmount = "" + dolAmount + aChar;
         }
      }
      if(aChar == ".") {
         if(decFlag) {
            dolAmount = "";
            break;
         }
         decFlag=true;
      }
   }

   // Ensure that at least a zero appears for the dollar amount.

   if(dolAmount == "") {
      dolAmount = "0";
   }
   // Strip leading zeros.
   if(dolAmount.length > 1) {
      while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
         dolAmount = dolAmount.substring(1,dolAmount.length);
      }
   }

   // Round the decimal amount.
   if(decAmount.length > 2) {
      if(decAmount.substring(2,3) > "4") {
         decAmount = parseInt(decAmount.substring(0,2)) + 1;
         if(decAmount < 10) {
            decAmount = "0" + decAmount;
         }
         else {
            decAmount = "" + decAmount;
         }
      }
      else {
         decAmount = decAmount.substring(0,2);
      }
      if (decAmount == 100) {
         decAmount = "00";
         dolAmount = parseInt(dolAmount) + 1;
      }
   }

   // Pad right side of decAmount
   if(decAmount.length == 1) {
      decAmount = decAmount + "0";
   }
   if(decAmount.length == 0) {
      decAmount = decAmount + "00";
   }

   // Check for negative values and reset textObj
   if(newValue.substring(0,1) != '-' ||
         (dolAmount == "0" && decAmount == "00")) {
      textObj.value = dolAmount + "." + decAmount;

   }
   else{
      textObj.value = '-' + dolAmount + "." + decAmount;
   }
}

//Hide status bar msg javascript

function hidestatus(){
window.status='';
return true;
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus



function getInternetExplorerVersion()

//Returns the version of Internet Explorer or a -1
//(indicating the use of another browser).
{
 
var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer')
{
 var ua = navigator.userAgent;
 var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
 if (re.exec(ua) != null)
   rv = parseFloat( RegExp.$1 );
}
return rv;
}