// JavaScript Document
var s = document.referrer;
var ts = window.top.location.href;
var tss = window.top.location.href;
tss = tss.substr(tss.lastIndexOf("/")+1);

if (s.indexOf("bestcustom")==-1 && s.indexOf("giorgenti.com")==-1 && s.indexOf("clothesforsuccess.com")==-1 && s.indexOf("proimagetrainers.com")==-1 ){
		document.cookie = "Keywrd=" + document.referrer + ";path=/;Expires=8/13/2040";
}
document.cookie = "JavaScript=True;path=/;Expires=Thu, 01-Jan-40 00:00:01 GMT";
if (top.location != location) top.location.href = location.href;
window.status = "                ? HELP 1-800-815-4784      OR       help@bestcustomshirt.com";

function openh(){
	window.open('app.htm?Page='+ tss, 'Help', 'width=350,height=305,status=no,resizable=No, scrollbars=No ,top=100,left=100');
}
function openwin(URL,W,H,content){
	var pkp =	window.open(URL,'','width='+W+',height='+H+',status=No,resizable=No,scrollbars=Yes');
	pkp.focus();
	if (content!='' && content!=undefined) pkp.document.write(content);
}
function verifyemail(email) {
	if (email=="" || email.indexOf("@")==-1 || email.indexOf(".")==-1){
		return false;
	}
	email = email.toLowerCase();
	NotAllowed = Array("..",".@","@.","@@"," ",";" , ",");
	Allowed = Array("_","-","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",".","@");
	for (Ji=0;Ji< NotAllowed.length;Ji++){
		if (email.indexOf(NotAllowed[Ji])!=-1){	// Finds a character which is not allowed
			return false;
			break;
		}
	}	// --- Check . or @ is present either at the start or at the end
	if (email.substr(0,1)=="." || email.substr(0,1)=="@" || email.lastIndexOf(".")==(email.length-1) || email.lastIndexOf("@")==(email.length-1)){
		return false;	
	}
	TT = email.substring(email.indexOf("@")+1);
	if (TT.indexOf(".")==-1){ // Check . is not present after @
		return false;
	}
	if (TT.indexOf("@")!=-1){	// there are more than 1 @s in the email
		return false;
	}
	//-------------- Verify Allowed Characters --------------
	var found=false;
	for (Ji=0;Ji< email.length;Ji++){
		found = false;
		for (Ki=0;Ki< Allowed.length;Ki++){
			if (email.substr(Ji,1)==Allowed[Ki]){
				found=true;
				break;
			}
		}
		if (found==false){
			return false;
		}
	}
	//--------- If All tests above are OK then return true
	return true;
}
var lpPosY = screen.height/2 - 200;
var lpPosX = screen.width/2 - 200 ;
function openchat(){
//	var ppp = window.open('https://admin.instantservice.com/links/5668/22521','chat11536656','width=600,height=400,scrollbars=1');
//	ppp.focus();
	var ppp = window.open('http://server.iad.liveperson.net/hc/11536656/?cmd=file&file=visitorWantsToChat&site=11536656&referrer='+document.location,'chat11536656','width=472,height=320');
	ppp.focus();
}
setTimeout("window.location.reload()",3300000);
function unlod(){
	var loc = window.top.location.href;
	loc = loc.toLowerCase();
	var opend = false;

	var pgn = loc.substr(loc.lastIndexOf("/")+1);
	if (navigator.appName == "Microsoft Internet Explorer"){
		if (document.activeElement==undefined){
			opend = true;
		 }
	} else {
			opend = true;
	} 	
	
	if (opend==true){
		if (loc.indexOf("cart.asp")!=-1 || loc.indexOf("placeorder2.asp")!=-1){
			var openw = "newpopf.htm?Pg=" + pgn;
		} else if (loc.indexOf("invoice.asp")==-1 && loc.indexOf("reorderOptions.asp")==-1 && loc.indexOf("thankyou.asp")==-1){
			var openw = "newpopf.htm?Pg=" + pgn;
		}
		if (openw!=""){
			var winop = window.open('', 'winop', 'width=10,height=10,status=no,resizable=No, scrollbars=Yes ,top=250,left=350');
			winop.blur();
			winop.location = openw;
		}
	}
}
