/* Copyright AshAlom.com 1997-2009. Licenced to Ash Alom. ashalom [AT] gmail [Dot COM]
**************************************************************************************/


//window.onerror=stopError;
//function stopError(){return true;}

window.google_analytics_uacct = "UA-137570-6";

var bV=parseInt(navigator.appVersion);
var NS4=(document.layers)?true:false;
var IE4=((document.all)&&(bV>=4))?true:false;
var ver4=(NS4||IE4)?true:false;
var VerMinor=parseFloat(navigator.appVersion);	// ex. 3.01
var OS;
if (navigator.appVersion.toLowerCase().indexOf("win")!=-1) {OS = "Win";}
if (navigator.appVersion.toLowerCase().indexOf("mac")!=-1) {OS = "Mac";};

function ValidateeMail(DOM){
	var NetCore
	var filter=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})$/
	if (filter.test(DOM)){
		NetCore=true
	}else{
		NetCore=false
	}
	return (NetCore)
}

function GetCookie(byname){
	byname=byname+"=";
	nlen = byname.length;
	fromN = document.cookie.indexOf(byname)+0;
	if((fromN) != -1){
		fromN +=nlen
		  toN=document.cookie.indexOf(";",fromN)+0;
		if(toN == -1){toN=document.cookie.length;}
		return unescape(document.cookie.substring(fromN,toN));
	}
	return "";
}

function SetCookie(name,value,time){
	exp = new Date();
	if((name==null)||(value==null)) return false;
	if(time==null) time=365*86400000;
	exp.setTime(exp.getTime()+time);
	document.cookie =escape(name)+"="+escape(value)+"; expires="+exp.toGMTString()+"; path=/; domain=";
	return true;
}

function DeleteCookie(name){
	exp=new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = GetCookie ("name");
	document.cookie = name + "=" + cval +"; expires=" + exp.toGMTString()+"; path=/; domain=";
}

function TrimLeadingAndTrailingChars(X,Y){
	while(X.value.charAt(X.value.length-1)==' '){
		X.value=X.value.substring(0,X.value.length-1);
	}
	while(X.value.charAt(0)==' '){
		X.value=X.value.substring(1,X.value.length);
	}
	if (Y != "DontStripHTML"){
		X.value=StripHTML(X.value);
	}
}

function StripHTML(string){
	 var strip = new RegExp();
	 strip = /[<][^>]*[>]/gi;
	 return string.replace(strip, "");
}

function NotHolly(){
	alert("ERROR - Unable to comply!\n\nYou are not Holly Denham.");
}

function Logout(X, Y){
	if(confirm("Do you want to Logout?")){
		top.document.location.href="logout.php?"+X+"="+Y;
	}
	self.focus();
}

function CenterWindow(URL,WindowName,Width,Height,ScrollBars,Resizable,MenuBar,ToolBar,Location,Directories,Status){
 if (!WindowName) {var WindowName='HollysInBox_NetCore_AshAlom'}
 if (!Width) {var Width=550}
 if (!Height) {var Height=350}
 if (!ScrollBars) {var ScrollBars=0}
 if (!Resizable) {var Resizable=0}
 if (!MenuBar) {var MenuBar=0}
 if (!ToolBar) {var ToolBar=0}
 if (!Location) {var Location=0}
 if (!Directories) {var Directories=0}
 if (!Status) {var Status=0}
  var winl = (screen.width - Width) / 2;
  var wint = (screen.height - Height) / 2;
  winprops = 'height='+Height+',width='+Width+',top='+wint+',left='+winl+',toolbar='+ToolBar+',location='+Location+',status='+Status+',menubar='+MenuBar+',scrollbars='+ScrollBars+',resizable='+Resizable+'';
  win = window.open(URL, WindowName, winprops);
  if(!win){alert("ERROR!\nUnable to launch browser window.\n\nYou need to disable your popup blocker to continue.");}
  if(parseInt(navigator.appVersion)>=4){win.window.focus();}
}
