

function nav2parent(url){
	window.opener.location = url;
	window.close();
}

var newWin;
function poplist(id){
	var url = "help.aspx?pid=" + id;
	if(!newWin || newWin.closed){
		newWin = window.open(url,"newWin","height=300,width=370,scrollbars=yes,menubar=yes");
		newWin.focus();
	}else{
		newWin.location = url;
		newWin.focus();
	}
}

function poplistNoFAQ(id){
	var url = "help.aspx?faq=0&pid=" + id;
	if(!newWin || newWin.closed){
		newWin = window.open(url,"newWin","height=300,width=370,scrollbars=yes,menubar=yes");
		newWin.focus();
	}else{
		newWin.location = url;
		newWin.focus();
	}
}

function popVerisign() {
sealWin=window.open("https://digitalid.verisign.com/as2/6c951dec9ea2c7e52a95eabef98f9a7f","win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
self.name = "mainWin";
}
function checkradioandshowwaiting(arr){
	var ret = false;

	for(var i=0;i<arr.length;i++){
		if(checkradio(arr[i],arr[i+1])){
			ret = true;
			i++;
		}else{
			ret = false;
			break;
		}
		
	}
	if(ret){
		showwaiting();
		return true;
	}else{
		return false;
	}
}
function checkradiogroup(arr){
	var ret = false;

	for(var i=0;i<arr.length;i++){
		if(checkradio(arr[i],arr[i+1])){
			ret = true;
			i++;
		}else{
			ret = false;
			break;
		}
		
	}
	if(ret){
		return true;
	}else{
		return false;
	}
}
function checkturnaround(el1,mes,el2){
	var ret = false;

	for(var i=0;i<arr.length;i++){
		if(checkradio(arr[i],arr[i+1])){
			ret = true;
			i++;
		}else{
			ret = false;
			break;
		}
		
	}
	if(el2.checked){
		return ret;
	}else{
		return true;	
	}

}
function findInAsp(form,el){
    var prefix = "_ctl0:ContentPlaceHolder1:";
    return form[prefix + el];
}
function toggleaddresses(form,checked){
	if(checked){
		findInAsp(form,"shipfirst").value = findInAsp(form,"first").value;
		findInAsp(form,"shiplast").value = findInAsp(form,"last").value;
		findInAsp(form,"shipaddress1").value = findInAsp(form,"address1").value;
		findInAsp(form,"shipaddress2").value = findInAsp(form,"address2").value;
		findInAsp(form,"shipcompany").value = findInAsp(form,"company").value;
		findInAsp(form,"shipcity").value = findInAsp(form,"city").value;
		findInAsp(form,"shipphone").value = findInAsp(form,"phone").value;
		findInAsp(form,"shipstate").selectedIndex = findInAsp(form,"state").selectedIndex;
		findInAsp(form,"shipzip").value = findInAsp(form,"zip").value;
		findInAsp(form, "shipemail").value = findInAsp(form, "email").value;
	}else{
		findInAsp(form,"shipfirst").value = "";
		findInAsp(form,"shiplast").value = "";
		findInAsp(form,"shipaddress1").value = "";
		findInAsp(form,"shipaddress2").value = "";
		findInAsp(form,"shipcompany").value = "";
		findInAsp(form,"shipcity").value = "";
		findInAsp(form,"shipphone").value = "";
		findInAsp(form,"shipstate").selectedIndex = 0;
		findInAsp(form,"shipzip").value = "";
		findInAsp(form, "shipemail").value = "";
	}
}
function copycontact(form,checked){
	if(checked){
		findInAsp(form,"shipfirst").value = findInAsp(form,"first").value;
		findInAsp(form,"shiplast").value = findInAsp(form,"last").value;
		findInAsp(form,"shipcompany").value = findInAsp(form,"company").value;
		findInAsp(form,"shipphone").value = findInAsp(form,"phone").value;
		findInAsp(form, "shipemail").value = findInAsp(form, "email").value;
	}else{
		findInAsp(form,"shipfirst").value = "";
		findInAsp(form,"shiplast").value = "";;
		findInAsp(form,"shipcompany").value = "";
		findInAsp(form,"shipphone").value = "";
		findInAsp(form, "shipemail").value = "";
	}
}
function validateRejectProofComments(form){
	var ret = false;
	if(findInAsp(form,"txtComments.value").length < 2){
		alert("Please provide a reason for rejecting the proofs.");	
		return false;
	}
	else
		return true;
}
function validateCancelOrderComments(form){
	var ret = false;
	if(findInAsp(form,"txtComments.value").length < 2){
		alert("Please provide a reason for canceling this order.");	
		return false;
	}
	else
		return true;
}
function validateshipping(form){
	var ret = false;
	if(findInAsp(form,"txtShipFirstName").value.length < 2){
		alert("First Name is Required");
		findInAsp(form,"txtShipFirstName").focus();
	}else if(findInAsp(form,"txtShipLastName").value.length < 2){
		alert("Last Name is Required");
		findInAsp(form,"txtShipLastName").focus();
	}else if(findInAsp(form,"txtShipAddress1").value.length < 2){
		alert("Address is Required");
		findInAsp(form,"txtShipAddress1").focus();
	}else if(findInAsp(form,"txtShipCity").value.length < 2){
		alert("City is Required");
		findInAsp(form,"txtShipCity").focus();
	}else if(findInAsp(form,"dropState").selectedIndex == 0){
		alert("Please select a State");
		findInAsp(form,"dropState").focus();
	}else if(!validatezip(findInAsp(form,"txtShipZip").value)){
		alert("Zip is Required");
		findInAsp(form,"txtShipZip").focus();
	}else if(!validatephone(findInAsp(form,"txtShipPhone").value)){
		alert("A valid telephone is Required.  Use xxx-xxx-xxxx.");
		findInAsp(form,"txtShipPhone").focus();
	}else{
		ret = true;
	}
	return ret;
}
function validatebilling(form){
	var ret = false;
	if(findInAsp(form,"txtFirstName").value.length < 2){
		alert("A valid first name is required");
	}else if(findInAsp(form,"txtLastName").value.length < 2){
		alert("A valid last name is required");
	}else if(findInAsp(form,"txtAddress1").value.length < 2){
		alert("Address is Required");
	}else if(findInAsp(form,"txtCity").value.length < 2){
		alert("City is Required");
	}else if(findInAsp(form,"dropState").selectedIndex == 0){
		alert("Please select a State");
} else if (!validatezip(findInAsp(form, "txtZip").value)) {
		alert("A valid zip code is Required");
	}else{
		ret = true;
	}
	return ret;
}

function validatephone(val){
	var objRegExp  = /^([\(]{1}[0-9]{3}[\)]{1}[\.| |\-]{0,1}|^[0-9]{3}[\.|\-| ]?)?[0-9]{3}(\.|\-| )?[0-9]{4}$/;// /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
	return objRegExp.test(val); 
}
function validatezip(val){
	var objRegExp  = /(^\d{5}$)|(^\d{5}-\d{4}$)/;
	return objRegExp.test(val); 
}
function checkradio(group,msg){
	var ischecked = false;
	for (c=0;c<group.length;c++){
		if(group[c].checked == true){
			ischecked  = true;
		}
	}
	if(!ischecked){
		alert(msg);
		return false;
	}
	return true;
}
function checkStandardLabel(ids, msg) {
    var oneSelected = false;
    for (var i = 0; i < ids.length; i++) {
        var drop = document.getElementById(ids[i]);
        if (drop.selectedIndex > 0) {
            oneSelected = true;
        }
    }
    if (!oneSelected) {
        alert(msg);
        return false;
    } else {
        return true;
    }

}
function checkCustomSize(height,width) {
    var dropH = document.getElementById(height);
    var dropW = document.getElementById(width);
    if (dropH.selectedIndex > 0 && dropW.selectedIndex > 0) {
        return true;
    } else {
        alert("Please select a height and width");
        return false;
    }
}
function IsCheckBoxChecked(checkbox,msg){
	if(checkbox.checked != true){
		alert(msg);
		return false;		
	}
	return true;
}
function showwaiting(){
	if(document.getElementById){
		document.getElementById('ProgressBar').style.display="block";
	}
}
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_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 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.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 DoUpload(orderid,foureyed,fromeaccount) {
	var theUniqueID = (new Date()).getTime() % 1000000000;
	var files;
	var progress;
	var url = "UploadWhizard_files.aspx?UploadID=" + theUniqueID;
	if(foureyed =='yes')
		url += '&4eyed=yes';	
	if(fromeaccount =='yes')
		url += '&eo=1';	
		
	var f = new Image;
	
	if(document.frames){
		progress = document.frames["progressframe"];
		files = document.frames["fileframe"];
	}else{
		progress = window.frames["progressframe"];
		files = window.frames["fileframe"];
	}
	if((files.theForm.File1.value + files.theForm.File2.value + files.theForm.File3.value + files.theForm.File4.value).length == 0){
		alert("You must select at least one file to upload");
		return;
	}
	f.src = getfakeurl(files.document,orderid,theUniqueID,foureyed,fromeaccount);
	files.theForm.target = "progressframe";
	files.theForm.action = url;
	files.__doPostBack('NextButton','');
	var tmp = "UploadWhizard_PreProgress.aspx?ProgressID=" + theUniqueID + '&orderid=' + orderid;
	if(foureyed =='yes')
		tmp += '&4eyed=yes';	
	if(fromeaccount =='yes')
		tmp += '&eo=1';		
	files.location = tmp
	//files.location = "UploadWhizard_progress.aspx?ProgressID=" + theUniqueID + '&orderid=' + orderid;
}
function DoUploadOnly(orderid,foureyed) {
	var theUniqueID = (new Date()).getTime() % 1000000000;
	var files;
	var progress;
	var url = "UploadOnly_files.aspx?4eyed=yes&UploadID=" + theUniqueID;
	//if(foureyed =='yes')
	//	url += '&4eyed=yes';	
	var f = new Image;
	
	if(document.frames){
		progress = document.frames["progressframe"];
		files = document.frames["fileframe"];
	}else{
		progress = window.frames["progressframe"];
		files = window.frames["fileframe"];
	}
	if((files.theForm.File1.value + files.theForm.File2.value + files.theForm.File3.value + files.theForm.File4.value).length == 0){
		alert("You must select at least one file to upload");
		return;
	}
	f.src = getfakeurl(files.document,orderid,theUniqueID,'yes','no');
	files.theForm.target = "progressframe";
	
	files.theForm.action = url;
	
	files.__doPostBack('NextButton','');
	//var tmp = "UploadOnly_progress.aspx?ProgressID=" + theUniqueID + '&orderid=' + orderid;
	//if(foureyed =='yes')
	//	tmp += '&4eyed=yes';	
	//files.location = tmp	
	files.location = "UploadOnly_progress.aspx?4eyed=yes&ProgressID=" + theUniqueID + '&id=' + escape(orderid);
}

function getfakeurl(doc,orderid,id,foureyed,fromeaccount){
	var f1 = '0';
	var f2 = '0';
	var f3 = '0';
	var f4 = '0';
	if(doc.Form1.File1.value != "") f1="1";
	if(doc.Form1.File2.value != "") f2="1";
	if(doc.Form1.File3.value != "") f3="1";
	if(doc.Form1.File4.value != "") f4="1";
	var url = 'recordupload.aspx?orderid=' + orderid + '&id=' + id + '&f1=' + f1 + '&f2=' + f2 + '&f3=' + f3 + '&f4=' + f4;
	if(foureyed =='yes')
		url += '&4eyed=yes';
	if(fromeaccount =='yes')
		url += '&eo=1';			
	return url;
}

function openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}
		function adimage() {
				this.width = '340'
				this.height = '70'
				this.src = ''
				this.href = ''
				this.border = ''
				this.mouseover = ''
				this.sponsor = ''
		}
var ads = new Array(13);
var n = Math.round(Math.random() * (ads.length - 1)) ;



		ads[0] = new adimage();
		ads[0].src = "images/banners/testi1.gif";
		ads[0].href = "testi.aspx";
		
		ads[1] = new adimage();
		ads[1].src = "images/banners/testi2.gif";
		ads[1].href = "testi.aspx";
		
		ads[2] = new adimage();
		ads[2].src = "images/banners/testi3.gif";
		ads[2].href = "testi.aspx";
		
		ads[3] = new adimage();
		ads[3].src = "images/banners/testi4.gif";
		ads[3].href = "testi.aspx";
		
		ads[4] = new adimage();
		ads[4].src = "images/banners/testi5.gif";
		ads[4].href = "testi.aspx";
		
		ads[5] = new adimage();
		ads[5].src = "images/banners/testi6.gif";
		ads[5].href = "testi.aspx";
		
		ads[6] = new adimage();
		ads[6].src = "images/banners/testi7.gif";
		ads[6].href = "testi.aspx";
		
		ads[7] = new adimage();
		ads[7].src = "images/banners/testi8.gif";
		ads[7].href = "testi.aspx";
		
		ads[8] = new adimage();
		ads[8].src = "images/banners/testi9.gif";
		ads[8].href = "testi.aspx";
		
		ads[9] = new adimage();
		ads[9].src = "images/banners/testi10.gif";
		ads[9].href = "testi.aspx";
		
		ads[10] = new adimage();
		ads[10].src = "images/banners/testi11.gif";
		ads[10].href = "testi.aspx";
		
		ads[11] = new adimage();
		ads[11].src = "images/banners/equipment1.jpg";
		ads[11].href = "equipment.aspx";
		
		ads[12] = new adimage();
		ads[12].src = "images/banners/equipment2.jpg";
		ads[12].href = "equipment.aspx";

	var image = ads[n];
var ad = "";

		ad += '<a href="' + image.href + '" \n';
		ad += 'onMouseOver="self.status=\'' + image.mouseover + '\'\;return true" \n';
		ad += 'onMouseOut="self.status=\'\'"> \n';
		ad += '<img alt="posters, labels, printing services, stickers, label printing, poster printing"  src="' + image.src + '" width=' + image.width;
		ad += '\n height=' + image.height + ' border=0></a>';
		if(document.body){
			//document.body.onLoad=MM_preloadImages('images/nav/home_dn.gif','images/nav/order_dn.gif','images/nav/guide_dn.gif','images/nav/policies_dn.gif','images/nav/eaccount_dn.gif','images/nav/shipquote_dn.gif','images/nav/faqs_dn.gif','images/nav/template_dn.gif','images/nav/formats_dn.gif','images/nav/postcard_dn.gif','images/nav/cs_dn.gif','images/nav/diecut_dn.gif','images/nav/contact_dn.gif','images/nav/directions_dn.gif');
		}