var g_bIsDirty=false;
		var dtCh= "/";
		var minYear=1900;
		var maxYear=2100;

		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 formattedDate(dtStr)
		{
			var sOut='';
			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);

			if (strDay.length == 1){
				strDay = '0' + strDay;
			}

			if (strMonth.length == 1){
				strMonth = '0' + strMonth;
			}

			if (pos1==-1 || pos2==-1){
				sOut = dtStr;
			}

			if (sOut == ''){
				sOut = strMonth + dtCh + strDay + dtCh + strYear;
			}

			return sOut;
		}

		function isDate(dtStr,dtLabel){
			var sOut='';
			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);
			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){
				sOut = 'The date format for ' + dtLabel + ' should be : mm/dd/yyyy! The format should be MM/DD/YYYY.';
			}

			if (strMonth.length<1 || month<1 || month>12){
				sOut = 'Please enter a valid month for ' + dtLabel + '! The format should be MM/DD/YYYY.';
			}
			if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
				sOut = 'Please enter a valid month day for ' + dtLabel + '! The format should be MM/DD/YYYY.';
			}
			if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
				sOut = 'Please enter a valid 4 digit year between ' + minYear + ' and ' + maxYear + ' for ' + dtLabel + '! The format should be MM/DD/YYYY.';
			}
			if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
				sOut = 'Please enter a valid date for ' + dtLabel + '! The format should be MM/DD/YYYY.';
			}

			var today = new Date();
			var chosenDate = new Date();
			chosenDate.setFullYear(strYr,strMonth-1,strDay);

/*			if (chosenDate>today){
				sOut = '';
				return true
			}
			else{
				alert("Please enter a date in the future!")
				return false
			}
*/

		return sOut
		}

function onChangeElement(){
	g_bIsDirty=true;
	window.status="";
}

function checkCost(frm){
	if(isNaN(parseFloat(frm.txtTrxUnitCost.value))){
		alert('You should enter Unit Cost first!');
		frm.txtTrxUnitCost.focus();};
}


function itemManage(frm,sAct,itemID,lSecure,sSts,sItem,lUri){
	var lDelete=3;
	var lAdd=5;
	var sID="";
	var bDirty="";
	var sURL= "";

	if(typeof(itemID)=="undefined") itemID=0;
	if(typeof(sItem) =="undefined" && typeof(lUri) == "undefined" || itemID.toString().substr(0,1)!="&"){
		var aArg=GetParams(frm,sID,sItem,lUri,sAct);

		if (itemID.toString().substr(0,1)=="&")	sID=itemID;
		else									sID = "&" + aArg[1] + "=" + itemID;
		sItem=aArg[2];
		lUri=aArg[3];
	}
	else sID=itemID;

	if (typeof(sSts)=="undefined")	sSts="";

	if (sAct==lDelete||sAct==7) //Delete
	{
		var msgConfirm=confirm("You are about to delete a " + sItem);
		if (msgConfirm==true)
		{
			if (sSts != "")	sURL=sSts;
			else			sURL="admin.asp?uri=" + lUri + "&action=" + sAct + sID ;

			frm.action = sURL;
			frm.submit();
		}
		return;
	}

	if (Validate(frm,lSecure,sAct,itemID)!="stop"){
		if(typeof(frm.changed)=="object"){
			if (g_bIsDirty) bDirty="true"
			else			bDirty=frm.changed.value;
			if (frm.changed.value!="back") frm.changed.value="true";
		}
		if (sSts != "")	sURL=sSts + "&ch="+bDirty;
		else			sURL="admin.asp?uri=" + lUri + "&action=" + sAct + sID + "&ch="+bDirty;
		frm.action = sURL;
		frm.submit();
	}
}

function onClose(frm,sAct,lID,lSecure,sSts,sNext,lUri,lRtUri,state){
	var sURL="";

	var sID="";
	var sItem="";
	var bDirty="";
	var sIDs="";
	var pos=-1;
	sID=lID;

	if (typeof(sSts)=="undefined")	sSts="";
	if (typeof(sNext)=="undefined")	sNext="";
	if (typeof(state)=="undefined")	state="close"

	if(typeof(lUri) == "undefined" || lID.toString().substr(0,1)!="&"){
		var aArg=GetParams(frm,sID,sItem,lUri,sAct);
		sItem=aArg[2];
		lUri=aArg[3];
		if(lUri==2023) sID="pi";
		if (lID.toString().substr(0,1)=="&") sID=lID;
		else sID = "&" + aArg[1] + "=" + lID;
	}

	if (typeof(lRtUri)=="undefined"){
		//take URL from hidden control
		if(typeof(frm.cll)=="object"){
			if(frm.cll.value!="") sURL=frm.cll.value;
			else sURL="admin.asp?uri=" + (lUri-1);
		}
		else sURL="admin.asp?uri=" + (lUri-1);

		if (lUri==2036 && sURL=='') sURL="admin.asp?uri=2034";
		if (lUri==2004 && sAct==17) sURL="admin.asp?uri=2004&action=2&di=" + lID;
		if (lUri==2204) sURL="admin.asp?uri=2018&action=2&ci=" + lID;
		if (sSts != "")	sURL=sSts;
	}
	else {
		if (lRtUri.toString().indexOf("http")<0 && lRtUri.toString().indexOf("admin.asp")<0){sURL="admin.asp?uri=" + lRtUri;}
		else{sURL=lRtUri}
	}

	if (lUri==2022) pos=sIDs.search("&ci=");

	if(typeof(frm.changed)=="object") bDirty=frm.changed.value;

	if (lUri==2018 && lSecure==11)
		if (frm.LoginName.value=="" || frm.LoginPass.value=="")
			g_bIsDirty=true;
	if (g_bIsDirty||bDirty.toLowerCase()=="true"){
		if(typeof(frm.changed)=="object" && frm.changed.value!='back') frm.changed.value="true";
		var bCloseIsConfirmed = confirm("Do you want to save the changes you made?");
		if (bCloseIsConfirmed==true){

			//Save and close the page
			if (Validate(frm,lSecure,sAct,lID)=="stop"){
				return;
			}
			else{
				if(lUri==2004 && (sAct==5 || sAct==17))
				{
					if (sAct==17)	CheckInFiles("17" + sNext,lID,"close");
					else			UploadFiles(5,0,"close");
				}
				else
				{
					if (sSts != "")	sURL=sSts + "&state=" + state;
					else			sURL="admin.asp?uri=" + lUri + "&action=" + sAct + sID + "&state=" + state;

					frm.action = sURL;
					frm.submit();
				}
			}
		}
		else
		{
			if (state=="windowclose")
				window.close();
			//go further
			if (lUri==2018){
				if (sNext=="next=0" && (lSecure==2 || (lSecure==11 && sSts == ""))){
					sURL="admin.asp?uri=2018&action=30";
				}else{
					if (lSecure==11)
						sURL=sNext; //here this is Cancel link
				}
			}
			if (sSts!="" && sNext!="")
				sURL=sNext //here this is Cancel link
			document.location=sURL;
		}
	}
	else
	{
		if (state=="windowclose")
			window.close();
		//go further as usually
		if (lUri==2018){
			if (sNext=="next=0" && (lSecure==2 || (lSecure==11 && sSts == ""))){
				sURL="admin.asp?uri=2018&action=30";
			}else{
				if (lSecure==11)
					sURL=sNext; //here this is Cancel link
			}
		}
		if (lUri==2022 && pos>-1 && pos+4<sIDs.length) sURL="admin.asp?uri=2222&pi=" + lID;
		if (sSts!="" && sNext!="")
			sURL=sNext //here this is Cancel link
		document.location=sURL;
	}
}

function GetParams(frm,sID,sItem,lUri,sAct){

	switch (frm.name){
		case "frmMemberManage":
			sID="ci";			sItem="Member";				lUri=2018;
			break;
		case "frmOrderManage":
			sID="oi";			sItem="Order";				lUri=2035;
			break;
		case "frmFulfillOrder":
			sID="oi";			sItem="Order";				lUri=2036;
			break;
		case "frmCompMgmt":
			sID="ci";			sItem="Company";			lUri=2231;
			break;
		default:
			sID="";
			sItem="";
			lUri=0;
			break;
	}
	return GetParams.arguments;
}

function Validate(frm,lSecure,lAction,sItm){
	var sItem="";
	var sMsg="";
	var sStopStr="stop";
	var lAdd=5;

	switch (frm.name){
		case "frmCompMgmt":
			sMsg = ValidateCompanies(frm);
			if (sMsg != "")
				sItem=sStopStr;
			break;
		case "frmMemberManage":
			sMsg = ValidateContacts(frm, lSecure);
			if (sMsg != "")	sItem=sStopStr;
			break;
		case "frmQuickRegBuilder":
			if(typeof(frm.QuickRegName)=="object" && frm.QuickRegName.value==''){
				alert('Please, enter the Name');
				frm.QuickRegName.focus();
				sItem=sStopStr;
				break;
			}
			if((typeof(frm.Address)=="object" && frm.Address.checked==true) || (typeof(frm.req_Address)=="object" && frm.req_Address.checked==true)){
				if(typeof(frm.AddressType)=="object"){
					if (frm.AddressType[0].checked || frm.AddressType[1].checked || frm.AddressType[2].checked){
					}else{
						alert('Please, select Address Type - Home, Office or Both');
						sItem=sStopStr;
					}
				}
			}
			break;
		default:
			if(typeof(frm.JS)!="undefined") {
				sMsg = FRMValidate();
				if (sMsg != "")	sItem=sStopStr;
			}
			else sItem="";
			break;
	}
	return sItem;
}

function isNumFunction(Val){
	var i;

	if (Val != ""){
		for (i=0;i<Val.length;i++){
			if (Val.charAt(i)>="0" && Val.charAt(i)<="9")
				continue;
			switch (Val.charAt(i))
			{
				case " " :
				case "(" :
				case ")" :
				case "+" :
				case "-" :
				case "." :
				case "," :
				case ":" :
				case "/" :
				case "$" :
					continue;
			}
			return false;
		}
	}
	return true;
}

function isZip(Val){
	var i;

	if (Val != ""){
		for (i=0;i<Val.length;i++){
			if (Val.charAt(i)=="-")
				continue;
			if (Val.charAt(i)<"0" || Val.charAt(i)>"9")
				return false;
		}
	}
	return true;
}


function onDel(frm,itemID,sSts){
	var lDelete=3;

	if (typeof(frm.txtAction)!='undefined')
		frm.txtAction.value="DELETE";
	itemManage(frm,lDelete,itemID,0,sSts);
}

function onClickTwoChks(chk, chkOther,chkDeact){
	var iNPGrType=0;
	var sUrl="";

	if (!chk.checked && !chkOther.checked){
		chk.checked=true;
		return;
	}

	if (chk.checked){
		iNPGrType=iNPGrType+parseInt(chk.value);
	}
	if (chkOther.checked){
		iNPGrType=iNPGrType+parseInt(chkOther.value);
	}

	sUrl="admin.asp?uri=2201&NPGrType=" + iNPGrType ;
	if(chkDeact.checked) sUrl=sUrl + "&deact=yes";
	window.location=sUrl;
}


function onChkSwitchClick(chk,sLayerName){
	//changes the dirty flag, that shows s/th has been changed on the form
	g_bIsDirty=true;
	//alert(chk.checked);
	if (!chk.checked){
		MM_showHideLayers(sLayerName,'','hide');
	}
	else{
		MM_showHideLayers(sLayerName,'','show');
	}
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0

 var i,p,v,obj,args=MM_showHideLayers.arguments;
  try{oVal= eval("document.all.hdn" + args[0]); oVal.value=args[2];} //store Layer condition(show/hide)
  catch(e){}
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) {
	v=args[i+2];
		if (obj.style.visibility){
			obj.style.visibility=(v=='show')?'visible':'hidden';
		}
		else obj.style.display=(v=='show')?'':'none';
	}
	//if(obj.name=='GroupsLayer')document.location = "#GroupsAnchor";
}

function TogleCheckBox(id,frm,bCtr)
{
	g_bIsDirty=true;
	if(typeof(frm)!="object")frm=document.frmFilters;
	var pos;
	var ctl=document.getElementById(id);
	var sIDs=frm.txtSelIDs.value;
	var bCondition=false;

	pos=sIDs.search(ctl.name + ",");
	bCondition=typeof(bCtr)!='undefined'?! ctl.checked :ctl.checked
	if(bCtr!='true' && typeof(bCtr)!='undefined')bCondition= (ctl.value== bCtr) //used for other control (combo)
	if (bCondition)
	{
		if (pos<0)
				frm.txtSelIDs.value=frm.txtSelIDs.value + ctl.name + ",";
	}
	else
	{
		if (pos>0)
			frm.txtSelIDs.value=sIDs.substr(0,pos-1) + sIDs.substr(pos+ctl.name.length);
		else if (pos==0)
		        frm.txtSelIDs.value=sIDs.substr(ctl.name.length);
	}
}

function ToggleCheckBox(id,frm,bCtr)
{
	g_bIsDirty=true;
	if(typeof(frm)!="object")frm=document.frmFilters;
	var pos;
	var ctl=document.getElementById(id);
	var sIDs=frm.txtSelIDs.value;
	var bCondition=false;

	pos=sIDs.search(ctl.name.substr(2) + ",");
	bCondition=typeof(bCtr)!='undefined'?! ctl.checked :ctl.checked
	if(bCtr!='true' && typeof(bCtr)!='undefined')bCondition= (ctl.value== bCtr) //used for other control (combo)
	if (bCondition)
	{
		if (pos<0)
				frm.txtSelIDs.value=frm.txtSelIDs.value + ctl.name.substr(2) + ",";
	}
	else
	{
		if (pos>0)
			frm.txtSelIDs.value=sIDs.substr(0,pos-1) + sIDs.substr(pos+ctl.name.length-2);
		else if (pos==0)
		        frm.txtSelIDs.value=sIDs.substr(ctl.name.length-2);
	}
}

function ToggleCheck(id,frm,bCtr)
{
	g_bIsDirty=true;
	if(typeof(frm)!="object")frm=document.frmFilters;
	var pos;

	ctl=eval("document.getElementById('fi" + id + "')");

	var sIDs=frm.txtSelFeatureIDs.value;
	var bCondition=false;

	pos=sIDs.search(ctl.name.substr(2) + ",");
	bCondition=typeof(bCtr)!='undefined'?! ctl.checked :ctl.checked


	if(bCtr!='true' && typeof(bCtr)!='undefined')bCondition= (ctl.value== bCtr) //used for other control (combo)
	if (bCondition)
	{
		if (pos<0)
				frm.txtSelFeatureIDs.value=frm.txtSelFeatureIDs.value + ctl.name.substr(2) + ",";
	}
	else
	{
		if (pos>0)
			frm.txtSelFeatureIDs.value=sIDs.substr(0,pos-1) + sIDs.substr(pos+ctl.name.length-2);
		else if (pos==0)
		        frm.txtSelFeatureIDs.value=sIDs.substr(ctl.name.length-2);
	}

	var ctrl=eval("document.getElementById('pi" + id + "')");
	ctrl.checked=true;
	ToggleCheckBox("pi" + id );

}

function onCboSwitchClick(cbo,sLayerName,iTrueValue){
	//changes the dirty flag, that shows s/th has been changed on the form
	g_bIsDirty=true;
	if(typeof(iTrueValue)=="undefined")iTrueValue=1;
	if (cbo.options(cbo.selectedIndex).value != iTrueValue){
		MM_showHideLayers(sLayerName,'','hide');
	}
	else{
		MM_showHideLayers(sLayerName,'','show');
	}
}

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_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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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];}
}

function printArticle()
{
  if (window.print)	setTimeout('window.print();',50);
  else alert("Press 'Ctrl+p' on your keyboard to print article.")
}
/*
Custom confirm dialog window
call mdOpen(msg(index or string),'width','height','   Button1Label   ','  Button2Label  ','true','  Button3Label  ',Button3Action)
*/
var MsgArray = new Array(
	"Warning: changing the status of an order to CANCELED is irreversible.If you are not sure, we suggest placing the order ON HOLD.\n Are you sure you want to proceed?")

var idxMsg;
var sWidth = "";
var sHeight = "";
var popupReturnValue = "";

var Nav4 = (document.all) ? false : true;
var dialogWin = new Object()

function mdOpen(idx,paramwidth,paramheight,b1Label,b2Label,b3,b3Label,b3Action,Title,Img,ctrl,a1,a2){
		idxMsg = idx;
		sWidth = paramwidth;
		sHeight = paramheight;
		if (typeof(a1)=='undefined' && typeof(ctrl)=='undefined') a1=true;
		if (typeof(a2)=='undefined') a2=false;
		oArguments = new _ArgumentsArray(b1Label,b2Label,b3,b3Label,b3Action,Title,Img,ctrl,a1,a2)
		if(Nav4){
			openDialog(sWidth,sWidth,oArguments);
		}
		else{
			p= window.showModalDialog("ModalContent.htm",oArguments,_MDSetFeatures())
			popupReturnValue=p;
			if(popupReturnValue=="button")eval(b3Action);
			if (popupReturnValue==true || popupReturnValue==false || typeof(a1)=='undefined') return popupReturnValue;
			else rtn(popupReturnValue);
		}
}
function openDialog(width, height, args) {
	if (!dialogWin.win || (dialogWin.win && dialogWin.win.closed)) {
		// Initialize properties of the modal dialog object.
		dialogWin.returnFunc = retFunc;
		dialogWin.returnedValue = "";
		dialogWin.args = args;
		dialogWin.url = "ModalContent1.htm"
		dialogWin.width = width;
		dialogWin.height = height;
		// Keep name unique so Navigator doesn't overwrite an existing dialog.
		dialogWin.name = (new Date()).getSeconds().toString()
		// Assemble window attributes and try to center the dialog.
		// Generate the dialog and make sure it has focus.
		dialogWin.left = window.screenX +
			   ((window.outerWidth - dialogWin.width) / 2)
			dialogWin.top = window.screenY +
			   ((window.outerHeight - dialogWin.height) / 2)
			var attr = "screenX=" + dialogWin.left +
			   ",screenY=" + dialogWin.top + ",resizable=no,width=" +
			   dialogWin.width + ",height=" + dialogWin.height
		dialogWin.win=window.open(dialogWin.url, dialogWin.name,attr)
		dialogWin.win.focus()
	} else {
		dialogWin.win.focus()
	}
}

function retFunc(){
	rtn(dialogWin.returnedValue);
}

function rtn(val){
	if(typeof(val)=='string' && (val.indexOf('main.asp')==0 || val.indexOf('admin.asp')==0)){
		document.location=val;
	}
	else eval(val); //execute Action
}

function blockEvents() {
	window.captureEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS)
	window.onclick = deadend
	window.onfocus = checkModal
}

//Nav4 As dialog closes, restore the main window's original event mechanisms.
function unblockEvents() {
	window.releaseEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS)
	window.onclick = null
	window.onfocus = null
}

function deadend() {
	if (dialogWin.win && !dialogWin.win.closed) {
		dialogWin.win.focus()
		return false
	}
}

// Invoked by onFocus event handler of EVERY frame, return focus to dialog window if it's open.
function checkModal() {
	if (dialogWin.win && !dialogWin.win.closed) dialogWin.win.focus()
}

function _MDSetFeatures(){
	var sContent = MsgArray[idxMsg]
	sHeight = (sHeight!="" || isNaN(parseInt(sHeight)))?sHeight:"150" //Math.floor(sContent.length/2)
	sWidth = (sWidth!="" || isNaN(parseInt(sWidth)))?sWidth:"250"
	if(navigator.appVersion.indexOf("Windows NT 5.1")>-1 || window.screen.height>=1024){ sHeight= parseInt(sHeight) + 40; sWidth=parseInt(sWidth) + 40;}

    var sFeatures="dialogHeight: " + sHeight + "px;";
	sFeatures +="dialogWidth: " + sWidth + "px;";

	sFeatures +=" resizable:yes;"
	sFeatures +=" status:no;"
	sFeatures +=" scroll:no;"
	sFeatures +=" menubar=no,"
	sFeatures +=" modal=yes"
	return sFeatures;
}

function _ArgumentsArray(b1Label,b2Label,b3,b3Label,b3Action,Title,Img,ctrl,a1,a2){
	this.msg=(isNumFunction(idxMsg))?MsgArray[idxMsg]:idxMsg;
	this.button1 = b1Label
	this.button2 = b2Label
	this.button3 = b3
	this.label = b3Label
	this.action = b3Action
	this.Title = Title
	this.Img = Img
	this.ctrl = ctrl
	this.action1 = a1;
	this.action2 = a2
}

function _onSubmitListing(frm,URL,IsValid,Sts){
	if (typeof(frm)=='undefined') frm=document.forms[0] //when form passed does not match Form obj,get 1 form obj
	if (typeof(URL)=="undefined")		URL="";
	if (typeof(IsValid)=="undefined")	IsValid="no";
	if (typeof(Sts)=="undefined")		Sts="";

	if (IsValid=="yes" || typeof(frm.JS)!='undefined'){
		if (FRMValidate(frm)=="stop") return;

		pr_SubmitForm(frm,URL,Sts);
	}else{
		pr_SubmitForm(frm,URL,Sts);
	}
}

function _onSave(frm,URL,IsValid,Sts){
	if (typeof(frm)=='undefined') frm=document.forms[0] //when form passed does not match Form obj,get 1 form obj
	if (typeof(URL)=="undefined")		URL="";
	if (typeof(IsValid)=="undefined")	IsValid="no";
	if (typeof(Sts)=="undefined")		Sts="";

	if (RequiredFlds()!="") return;
	if (IsValid=="yes" || typeof(frm.JS)!='undefined'){
		if (FRMValidate(frm)=="stop") return;

		pr_SubmitForm(frm,URL,Sts);
	}else{
		pr_SubmitForm(frm,URL,Sts);
	}
}
//if there is a lookup in form and we need to save the changes after lookup set bConfirm parametr to 'true'
function _onClose(frm,URL,rtURL,IsValid,state,Sts,bConfirm){

	var Dirty="";
	if (typeof(URL)=="undefined")					URL="";
	if (typeof(IsValid)=="undefined")				IsValid="no";
	if (typeof(state)=="undefined" || state=='')	state="close";
	if (typeof(Sts)=="undefined")					Sts="";
	if (typeof(rtURL)=="undefined"){
		if(typeof(frm.cll)=="object" && frm.cll.value!="")	rtURL=frm.cll.value;//take URL from hidden control
		else rtURL="";
	}
	if (rtURL=="")	rtURL="admin.asp?uri=9999"
	if (rtURL.indexOf('.asp?uri=')==-1) rtURL='admin.asp?uri=' + rtURL; //Add .asp page if omitted
	if (rtURL.indexOf(serverName)==-1) rtURL=serverName + rtURL; // Add ServerName (avoid STS problems)

	if (typeof(frm.changed)=="object"){
		Dirty=frm.changed.value;
		if (frm.changed.value!="back")		frm.changed.value="true";
	}

	if (g_bIsDirty||Dirty.toLowerCase()=="true"||bConfirm=="true"){
		var IsCloseConfirmed = confirm("Do you want to save the changes you made?");
		if (IsCloseConfirmed==true){

			if (RequiredFlds()!="") return;
			//Save and close the page
			if (IsValid=="yes" || typeof(frm.JS)=='object'){
				if (FRMValidate(frm)=="stop") return;

				pr_SubmitForm(frm,URL,Sts,'&state='+state);
			}else{
				pr_SubmitForm(frm,URL,Sts,'&state='+state);
			}
		}
		else{
			if (state=="windowclose")	window.close();
			document.location=rtURL;
		}
	}
	else{
		if (state=="windowclose")	window.close();
		document.location=rtURL;
	}
}
//Inner Links in Form - Submit only when a change has been made
function _onClick(frm,URL,gotoURL,IsValid,Sts){
	var Dirty="";
	if (typeof(frm.changed)=="object")				Dirty=frm.changed.value;
	if (g_bIsDirty||Dirty.toLowerCase()=="true")	_onSave(frm,URL,IsValid,Sts);
	else	document.location=gotoURL;
}

function BCPRequiredFlds(){ // Can't be used for Checkboxes/Radio buttons!!!
	var sRtn="";
	var isADate="";
	var isAValidSSN="";
	var sRtn2="";
	var sOutput='';
	var oType;
	var oRequired;
	var oCtl;
	var oVal;

//	1-1 input text
//	1-2 input date
//	1-3 input number
//	1-4 input memo
//	3-1 choice listbox
//	3-2 choice checkboxes
//	10 single choice

	for(i=1; i<100; i++){
		try{
			ctrl=eval("document.getElementById('q" + i + "')")
			//oType = ctrl.qtype;
			//oRequired = ctrl.requiredvalue;
			oType = ctrl.attributes['qtype'].nodeValue;
			oRequired = ctrl.attributes['requiredvalue'].nodeValue;

			try{
				oCtl=eval("document.getElementById('ans" + i + "')")
				oCtl.style.backgroundColor="";

/*if (i == 13){
	alert('13');
	alert(oType);
	alert(oRequired);
	alert(ctrl.attributes['requiredvalue'].nodeValue);
}*/
				if(oRequired == 'y'){
					switch(oType){
						case '1-1':
							oVal = oCtl.value;
							if(oVal==''){
								oCtl.style.backgroundColor="#FFFF33";
								sRtn = sRtn + '\t' + ctrl.className + '\n';
							}

							if(i == 11){
								isAValidSSN = SSNValidation(oVal);
								if(isAValidSSN!=''){
									oCtl.style.backgroundColor="#FFFF33";
									sRtn2 = sRtn2 + '\n' + isAValidSSN;
								}
							}
							break;
						case '1-2':
							oVal = oCtl.value;
							if(oVal==''){
								oCtl.style.backgroundColor="#FFFF33";
								sRtn = sRtn + '\t' + ctrl.className + '\n';
							}
							else{
								oCtl.value = formattedDate(oVal);
								isADate = isDate(oVal,ctrl.className);
								if(isADate!=''){
									oCtl.style.backgroundColor="#FFFF33";
									sRtn2 = sRtn2 + '\n' + isADate;
								}
							}
							break;
						case '1-3':
							oVal = oCtl.value;
							if(oVal==''){
								oCtl.style.backgroundColor="#FFFF33";
								sRtn = sRtn + '\t' + ctrl.className + '\n';
							}
							break;
						case '1-4':
							oVal = oCtl.value;
							if(oVal==''){
								oCtl.style.backgroundColor="#FFFF33";
								sRtn = sRtn + '\t' + ctrl.className + '\n';
							}
							break;
						case '3-1':
							oVal = oCtl.value;
							if(oVal=='0'){
								oCtl.style.backgroundColor="#FFFF33";
								sRtn = sRtn + '\t' + ctrl.className + '\n';
							}

							break;
						case '3-2':

							break;
						case '10':

							break;
						default:
					}
				}
				else{
					if (oType == '1-2'){
						oVal = oCtl.value;

						if(oVal!=''){
							oCtl.value = formattedDate(oVal);
							isADate = isDate(oVal,ctrl.className);
							if(isADate!=''){
								oCtl.style.backgroundColor="#FFFF33";
								sRtn2 = sRtn2 + '\n' + isADate;
							}
						}
					}
				}
			}
			catch(e){}
		}
		catch(e){}
	}

	if(sRtn!=''){
		sRtn = 'Please, select a value for \n \n' + sRtn;
	}

	sOutput = sRtn + sRtn2;

	if(sOutput == 'undefined'){
		sOutput = '';
	}

	if(sOutput!=''){
		alert(sOutput);
	}

	return sOutput;
}


function SSNValidation(ssn) {
	var sOut = '';
	var matchArr = ssn.match(/^(\d{3})-?\d{2}-?\d{4}$/);
	var numDashes = ssn.split('-').length - 1;

	if (matchArr == null || numDashes == 1) {
		sOut = 'Invalid SSN. Must be 9 digits or in the form NNN-NN-NNNN.';
	}

	return sOut;
}

function RequiredFldsListing(){ // Can't be used for Checkboxes/Radio buttons!!!
	var captchaValue = "";
	var captcha_wrapper = document.getElementById("CaptchaWrapper");
	var TrmsAccepted;
	var terms_wrapper;

	var sRtn="";
	for(i=1; i<100; i++){
		try{
			ctrl=eval("document.getElementById('Verify" + i + "')")
			if(ctrl.value==''){
				sRtn="stop";
				ctrl.style.backgroundColor="#FFFF33";
			}
			else {
				if(ctrl.type=='select-one'){
					if(ctrl.value=='0'){
						sRtn="stop";
						ctrl.style.backgroundColor="#FFFF33";
					}
					else{
						ctrl.style.backgroundColor="";
					}
				}
				else{
					ctrl.style.backgroundColor="";}
			}
		}
		catch(e){}
	}

	if (typeof(document.frmListing.AcceptedTerms)=="object") {
		TrmsAccepted = document.frmListing.AcceptedTerms.checked;
		terms_wrapper = document.getElementById("TermsWrapper");

		if (!TrmsAccepted) {
			sRtn="stop";
			if (terms_wrapper != null) {
				terms_wrapper.style.backgroundColor = "#FFFF33";
			}
		}
		else {
			if (terms_wrapper != null) {
				terms_wrapper.style.backgroundColor = "";
			}
		}
	}

	if (typeof(document.frmListing.captchacode)=="object") {
		captchaValue = document.getElementById("captchacode").value;
		if (captchaValue == "") {
			sRtn="stop";
			if (captcha_wrapper != null) {
				captcha_wrapper.style.backgroundColor = "#FFFF33";
			}
			else {
				document.getElementById("captchacode").style.backgroundColor = "#FFFF33";
			}
		}
		else {
			if (captcha_wrapper != null) {
				captcha_wrapper.style.backgroundColor = "";
			}
			else {
				document.getElementById("captchacode").style.backgroundColor = "";
			}
		}
	}

	if (sRtn == "stop") {
		alert('Please complete all required field(s) marked by the asterisk');
	}
	return sRtn;
}

function RequiredFlds(){ // Can't be used for Checkboxes/Radio buttons!!!
	var sRtn="";
	for(i=1; i<100; i++){
		try{
			ctrl=eval("document.getElementById('Verify" + i + "')")
			if(ctrl.value==''){
				var ctrName=ctrl.className!=''?ctrl.className:ctrl.name;
				alert("Please, enter " + ctrName + "!")
				sRtn="stop";
				ctrl.focus();
				break;
			}
		}
		catch(e){}
	}
	return sRtn;
}

function _onDelete(frm,URL,ItemName,Sts){
	if (typeof(ItemName)=="undefined")	ItemName="item";
	if (typeof(Sts)=="undefined")		Sts="";

	var msgConfirm=confirm("You are about to delete a " + ItemName);
	if (msgConfirm==true)	pr_SubmitForm(frm,URL,Sts);
}

function pr_SubmitForm(frm,URL,Sts,other){
	if (typeof(frm.saved)=="object"){
		if (frm.saved.value!="true") frm.saved.value="true";
		else return;
	}
	if (typeof(frm.encr)=="object") FRMEncoding();

	if (typeof(frm.changed)=="object" && frm.changed.value!="back") frm.changed.value="true";
	if (typeof(URL)=="undefined") URL="";
	if (typeof(Sts)!="undefined"){
		if (Sts!="")	URL=Sts;
	}
	if (URL=="") URL=frm.action; //when no URL is passed use FormAction
	if (URL.toLowerCase().indexOf('.asp?uri=')==-1 && URL.toLowerCase().indexOf('stsform.asp?ret=')==-1) URL='admin.asp?uri=' + URL; //Add .asp page if omitted
	if (typeof(other)!="undefined")	URL=URL + other;
	frm.action = URL;
	frm.submit();
	window.status='changes are being saved.....'
}

var keyActions = new Array ();

keyActions [0] = {character:  "m",
                  actionType: "link",
                  param:      "admin.asp?uri=2400"}; //main menu

keyActions [1] = {character:  "h",
                  actionType: "link",
                  param:      "home.asp?uri=1000"}; //home

var serverName="";
var pressedChr="";

// End of user defined array
function hotKeys (event,code) {

  // Get details of the event dependent upon browser
  event = event ? event : window.event ? window.event : null;

  // We have found the event.
  if (event) {
    // Hotkeys require that either the control key or the alt key is being held down
    if (event.ctrlKey && event.altKey) {
      // Pick up the Unicode value of the character of the depressed key.
      var charCode = (event.charCode) ? event.charCode : ((event.which) ? event.which : event.keyCode);
      // Convert Unicode character to its lowercase ASCII equivalent

      var myChar = String.fromCharCode (charCode).toLowerCase();
	  if(myChar!='t' && pressedChr!=''){myChar=pressedChr + '' + myChar; pressedChr='';}

      // Convert it back into uppercase if the shift key is being held down
      if (event.shiftKey) {myChar = myChar.toUpperCase();}

      // Now scan through the user-defined array to see if character has been defined.
      for (var i = 0; i < keyActions.length; i++) {

        // See if the next array element contains the Hotkey character
        if ((keyActions[i].character == myChar || keyActions[i].character =='ch' + charCode) && keyActions[i].param!='') {

          // Yes - pick up the action from the table
			var action;
			var param=keyActions[i].param;

          // If the action is a hyperlink, create JavaScript instruction in an anonymous function
          if (keyActions[i].actionType.toLowerCase() == "link") {
			if (param.indexOf(serverName)==-1) param = serverName + param; //take away javascript: from action and fix xslt smbs
            action = new Function ('location.href  ="' +  param + '"');
          }

          // If the action is JavaScript, embed it in an anonymous function
          else if (keyActions[i].actionType.toLowerCase()  == "code") {
			if (param.indexOf('javascript:')>-1) param = param.substr(11); //take away javascript: from action and fix xslt smbs
			var regex = new RegExp('&amp;', "g"); param = param.replace(regex,'&');

			if (typeof(code)!='undefined') action = new Function(code);
			else  action = new Function (param);
          }

          // Error - unrecognised action.
          else {
            alert ('Hotkey Function Error: Action should be "link" or "code"');
            break;
          }

          // At last perform the required action from within an anonymous function.
          action ();

          // Hotkey actioned - exit from the for loop.
          break;
        }
      }
    }
	else if (!event.ctrlKey && !event.altKey){ //other key pressed
		var targ;
		if (event.target) targ = event.target; //netscape
		else if (event.srcElement) targ = event.srcElement; //IE
		if (typeof(targ.type)!='undefined'){ g_bIsDirty=true;}
	}
  }
}

function delay(gap,myChar){ /* gap is in millisecs */
var then,now; then=new Date().getTime();
now=then;
pressedChr=myChar;
while((now-then)<gap)
{now=new Date().getTime();}
}


function keyAct(chr,act, actionType){
	if (typeof(actionType)=='undefined') actionType="code";
	var found = false;
	for (var i = 0; i < keyActions.length; i++){
		if (keyActions[i].character==chr){
			found=true;
			keyActions[i].param = act;
			keyActions[i].actionType = actionType;
		}
	}
	if (!found){
		i= keyActions.length;
		keyActions [i] = {character:  chr,
	                  actionType: actionType,
		              param:      act};
//		alert( i + keyActions[i].character + keyActions[i].param);
	}
}

function SaveAsForWidgetStyles(frm, URL, widgetID) {
	var profname="";
	var profType = "";
	var saveAsObj = document.getElementById("saveAs");
	var widgetTypeObj = document.getElementById("WIDGETTYPE");
	var nameObj = document.getElementById("Verify1");

	if (widgetTypeObj != null) {
		profType = widgetTypeObj.value;
	}

	profname=prompt("Save As Name:", "");

	if (profname!=null && profname!=""){
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }

		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		    {
					if (xmlhttp.responseText == 'True'){
						alert('Profile name must be unique.');
						nameObj.focus();
					}
					else {
						if (saveAsObj != null) {
							saveAsObj.value = "new";
						}

						if (typeof(nameObj)=="object"){
							if(nameObj != null){
								nameObj.value = profname;
							}
						}
						_onSave(frm, URL);
					}
		    }
		  }
//		alert("test.asp?uri=2030&action=666&act=saveas&name="+profname+"&id="+curr_profile+"&copy="+copyValue);
		xmlhttp.open("GET","test.asp?uri=2030&action=668&act=saveas&name="+profname+"&id="+widgetID+"&type="+profType,true);
		xmlhttp.send();


//		_pgsubmit();
	}
	else
	{alert('Please, enter the Name'); return;}
}

function SaveForWidgetStyles(frm, URL, widgetID) {
	var profname="";
	var profType = "";
	var widgetTypeObj = document.getElementById("WIDGETTYPE");
	var nameObj = document.getElementById("Verify1");

	if (widgetTypeObj != null) {
		profType = widgetTypeObj.value;
	}

	profname=nameObj.value;

	if (profname!=null && profname!=""){
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }

		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		    {
					if (xmlhttp.responseText == 'True'){
						alert('Profile name must be unique.');
						nameObj.focus();
					}
					else {
						_onSave(frm, URL);
					}
		    }
		  }
//		alert("test.asp?uri=2030&action=666&act=saveas&name="+profname+"&id="+curr_profile+"&copy="+copyValue);
		xmlhttp.open("GET","test.asp?uri=2030&action=668&act=save&name="+profname+"&id="+widgetID+"&type="+profType,true);
		xmlhttp.send();


//		_pgsubmit();
	}
	else {
		alert('Please, enter the Name');
		nameObj.focus();
	}
}

function ToggleMgmtSections(aidi,boolSect,HH){
 var obj = document.getElementById('Section'+aidi);
 if(!obj.PullDownMenu){
  obj.PullDownMenu = {
   hh: HH,
   interSection: 0,
   objH: 0,
   Sectionb: boolSect
  };
 }
 obj.PullDownMenu.Sectionb=obj.PullDownMenu.Sectionb?false:true;
 if(!obj.PullDownMenu.Sectionb){
  obj.PullDownMenu.interSection=setInterval('ShowMgmtSection(' + aidi + ')',3);
 }else{
  obj.PullDownMenu.interSection=setInterval('HideMgmtSection(' + aidi + ')',3);
 }
}

function ShowMgmtSection(aidi)
{
	var obj = document.getElementById('Section'+aidi);
  if(!obj.PullDownMenu.Sectionb){
  	if(obj.style.display=='none'){
    	obj.style.display = '';
  		obj.PullDownMenu.objH=obj.scrollHeight;
  		obj.style.overflow="hidden";
   	}

    if(obj.PullDownMenu.hh >= obj.PullDownMenu.objH){
    	clearInterval(obj.PullDownMenu.interSection);
    	obj.PullDownMenu.Sectionb=false;
    	ChangeMgmtArrow('Section'+aidi,true);
    	return;
    }

    obj.style.visibility = 'visible';
    obj.PullDownMenu.hh+=20 > obj.PullDownMenu.objH-obj.PullDownMenu.hh?obj.PullDownMenu.objH-obj.PullDownMenu.hh:20;
    obj.style.height = obj.PullDownMenu.hh + 'px';
   }
}


function HideMgmtSection(aidi)
{
  var obj = document.getElementById('Section'+aidi);
  if(obj.PullDownMenu.Sectionb){
     if(obj.PullDownMenu.hh==0.1){
      obj.PullDownMenu.hh=obj.scrollHeight;
      obj.PullDownMenu.objH=obj.scrollHeight;
     }
     if(obj.PullDownMenu.hh <= 20)
   {
     obj.style.display = 'none';
     clearInterval(obj.PullDownMenu.interSection);
     obj.PullDownMenu.Sectionb=true;
     ChangeMgmtArrow('Section'+aidi,false);
     return;
   }
     obj.PullDownMenu.hh-=20;
     obj.style.height = obj.PullDownMenu.hh + 'px';
    }
}

function ChangeMgmtArrow(oLayer,bool){
 var arrowObj=document.getElementById(oLayer+'CeilingImg');
 if(bool){
  if(arrowObj) arrowObj.src="images/icons/arup.png";
 }else{
  if(arrowObj) arrowObj.src="images/icons/ardown.png";
 }
}

var winDimensions = {
			getViewportDimensions: function(){
				var h = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight;
				var w = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;

				return { width : w , height : h }
			},

			getScrollXY: function() {
			  var scrOfX = 0, scrOfY = 0;
			  if( typeof( window.pageYOffset ) == 'number' ) {
			    //Netscape compliant
			    scrOfY = window.pageYOffset;
			    scrOfX = window.pageXOffset;
			  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			    //DOM compliant
			    scrOfY = document.body.scrollTop;
			    scrOfX = document.body.scrollLeft;
			  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			    //IE6 standards compliant mode
			    scrOfY = document.documentElement.scrollTop;
			    scrOfX = document.documentElement.scrollLeft;
			  }
			  return [ scrOfX, scrOfY ];
			},

			getDocHeight: function() {
			    var D = document;
			    return Math.max(
			        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
			        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
			        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
			    );
			},

			getDocWidth: function() {
			    var D = document;
			    return Math.max(
			        Math.max(D.body.scrollWidth, D.documentElement.scrollWidth),
			        Math.max(D.body.offsetWidth, D.documentElement.offsetWidth),
			        Math.max(D.body.clientWidth, D.documentElement.clientWidth)
			    );
			}
}


var customModalWindow = {
			BuildModalLikePopUp: function(boxtext){
				this.CreateModalDIVS();
				this.showCustomTransparentDiv();
				this.DoCustomFormbox(boxtext);
			},

			CreateModalDIVS: function(){
				var divEle1=document.createElement('div');
			  divEle1.setAttribute("id","customFormbox");
			  document.body.appendChild(divEle1);
			  var divSty1=document.getElementById("customFormbox").style;
			  divSty1.position="absolute"; divSty1.top="10px"; divSty1.left="10px";
			  divSty1.visibility="hidden";
			  divSty1.zIndex="999"; divSty1.opacity="1";
			  divSty1.filter="alpha(opacity=100)";

			  var divEle2=document.createElement('div');
			  divEle2.setAttribute("id","customTransparentDiv");
			  document.body.appendChild(divEle2);
			  var divSty2=document.getElementById("customTransparentDiv").style;
			  divSty2.position="absolute"; divSty2.top="0px"; divSty2.left="0px";
			  divSty2.visibility="hidden"; divSty2.zIndex="998";
			  divSty2.opacity="0.5";
			  divSty2.filter="alpha(opacity=55)";
			  divSty2.backgroundColor="#382D2C";

			  var divEle3=document.createElement('div'); //used only to put post data(if available) in it. Not to be shown!
			  divEle3.setAttribute("id","customHelpContainerDiv");
			  document.body.appendChild(divEle3);
			  var divSty3=document.getElementById("customHelpContainerDiv").style;
			  divSty3.visibility="hidden";
			},

			showCustomTransparentDiv: function() {
				document.getElementById("customTransparentDiv").style.visibility="visible";
				document.getElementById("customTransparentDiv").style.height = winDimensions.getDocHeight() + "px";
				document.getElementById("customTransparentDiv").style.width = winDimensions.getDocWidth() + "px";
			},

			DoCustomFormbox: function(boxtext){
				var divBody=boxtext;

				if(document.getElementById)
				{
					elm=document.getElementById("customFormbox");
					elm.innerHTML=divBody;
					this.centerCustomFormBox(elm);
					elm.style.visibility = "visible";
				}
			},

			CloseModalLikePopUp: function(){
				document.getElementById("customFormbox").style.visibility="hidden";
				document.getElementById("customTransparentDiv").style.visibility="hidden";
			},

			centerCustomFormBox: function(elm){
				var view=winDimensions.getViewportDimensions();
				var vScroll=winDimensions.getScrollXY();
				elm.style.left=(view.width/2+vScroll[0]) + "px";
				elm.style.marginLeft=(-1)*(elm.clientWidth/2) + "px";
				elm.style.top=(view.height/2+vScroll[1]) + "px";
				elm.style.marginTop=(-1)*(elm.clientHeight/2) + "px";
			}
}

