function pop(path,imgWidth,imgHeight)
{
	
	var windowLeft = screen.width/2 - imgWidth/2;
	var windowTop = screen.height/2 - imgHeight/2;
	var browser = navigator.appVersion;
	var windowWidth, windowHeight, popUpWindowH;

	if (browser.indexOf("Macintosh") >= 0) {
		windowWidth = imgWidth;
		windowHeight = imgHeight;
	} else {
		windowWidth = imgWidth + 20;
		windowHeight = imgHeight + 24;
	}

	popUpWindowH = window.open(path, "Horiz", "left=" + windowLeft + ",top=" + windowTop + ",width=" + windowWidth + ",height=" + windowHeight + ",resizable=yes,scrollbars=yes,status=no");
	
	popUpWindowH.resizeTo(windowWidth+10,windowHeight+30);

	popUpWindowH.focus();


}

function popPrint(path,imgWidth,imgHeight)
{
	
	var windowLeft = screen.width/2 - imgWidth/2;
	var windowTop = screen.height/2 - imgHeight/2;
	var browser = navigator.appVersion;
	var windowWidth, windowHeight;

	if (browser.indexOf("Macintosh") >= 0) {
		windowWidth = imgWidth;
		windowHeight = imgHeight;
	} else {
		windowWidth = imgWidth + 20;
		windowHeight = imgHeight + 24;
	}

	popUpWindowH = window.open(path, "Horiz", "left=" + windowLeft + ",top=" + windowTop + ",width=" + windowWidth + ",height=" + windowHeight + ",resizable=yes,scrollbars=yes,status=no,menubar=yes");

	popUpWindowH.focus();


}
function popV(path,imgWidth,imgHeight)
{
	
	var windowLeft = screen.width/2 - imgWidth/2;
	var windowTop = screen.height/2 - imgHeight/2;
	var browser = navigator.appVersion;
	var windowWidth, windowHeight;

	if (browser.indexOf("Macintosh") >= 0) {
		windowWidth = imgWidth;
		windowHeight = imgHeight;
	} else {
		windowWidth = imgWidth + 20;
		windowHeight = imgHeight + 24;
	}

	popUpWindowV = window.open(path, "Vert", "left=" + windowLeft + ",top=" + windowTop + ",width=" + windowWidth + ",height=" + windowHeight + ",resizable=yes,scrollbars=yes,status=no");

	popUpWindowV.focus();


}

function check(src,max,next) {
var blah = src.value.length;
	if (blah==max) {
		var key = window.event.keyCode;
		if (key!=9 && key!=16) {
			next.focus();
			next.select();
		}
	}
}

function authorize() {
var blah = document.register.authorized.checked;
	if (blah == false) {
		alert("You must give Colour TECH credit card authorization before continuing. Please check the appropriate box.");
		return false;
	} else {
		return true;
	}
}
function authorizeCC() {
var blah = document.credit.authorized.checked;
	if (blah == false) {
		alert("You must give Colour TECH credit card authorization before continuing. Please check the appropriate box.");
		return false;
	} else {
		return true;
	}
}
function checkenc() {
if (document.card.backimp) {
	if (document.card.backimp.checked==true) {
		document.card.bicontent.disabled=false;
		document.card.bitype.disabled=false;
			if (document.card.bicontent.selectedIndex != 1) {
				document.card.bimonth.disabled=true;
				document.card.bimonth.selectedIndex =0;
			} else {
				document.card.bimonth.disabled=false;
			}
	} else {
		document.card.bicontent.disabled=true;
		document.card.bitype.disabled=true;
		document.card.bicontent.selectedIndex=0;
		document.card.bitype.selectedIndex=0;
	}
	
	if (document.card.fstamp.checked==true) {
		document.card.fscolour.disabled=false;
		document.card.fsdetail.disabled=false;
	} else {
		document.card.fscolour.disabled=true;
		document.card.fscolour.selectedIndex=0;
		document.card.fsdetail.disabled=true;
		document.card.fsdetail.value='';
	}
}
}
function clearCard() {
	document.card.fullname.value='';
	document.card.title.value='';
	document.card.company.value='';
	document.card.address.value='';
	document.card.city.value='';
	document.card.state.selectedIndex=0;
	document.card.zipcode.value='';
	document.card.busnum1.value='';
	document.card.busnum2.value='';
	document.card.busnum3.value='';
	document.card.busnumext.value='';
	document.card.faxnum1.value='';
	document.card.faxnum2.value='';
	document.card.faxnum3.value='';
	document.card.dirnum1.value='';
	document.card.dirnum2.value='';
	document.card.dirnum3.value='';
	document.card.dirnumext.value='';
	document.card.resnum1.value='';
	document.card.resnum2.value='';
	document.card.resnum3.value='';
	document.card.oth1num1.value='';
	document.card.oth1num2.value='';
	document.card.oth1num3.value='';
	document.card.oth1numext.value='';
	document.card.cellnum1.value='';
	document.card.cellnum2.value='';
	document.card.cellnum3.value='';
	document.card.oth2num1.value='';
	document.card.oth2num2.value='';
	document.card.oth2num3.value='';
	document.card.oth2numext.value='';
	document.card.tollfreenum1.value='';
	document.card.tollfreenum2.value='';
	document.card.tollfreenum3.value='';
	document.card.website.value='';
	document.card.email.value='';
}


function copyData() {
	if (document.register.shipsame.checked) {
		document.register.s_fullname.value = document.register.fullname.value;
		document.register.s_company.value = document.register.company.value;
		document.register.s_address.value = document.register.address.value;
		document.register.s_city.value = document.register.city.value;
		document.register.s_zipcode.value = document.register.zipcode.value;
		document.register.s_state.selectedIndex = document.register.state.selectedIndex;
	}
}

function changeAgent(info) {
newData = info.split(";");
	document.card.fullname.value=newData[0];
	document.card.title.value=newData[1];
	document.card.company.value=newData[2];
	document.card.address.value=newData[3];
	document.card.city.value=newData[4];
	for (i=0;i<57;i++) {
			if (newData[5]==document.card.state.options[i].value) {
						document.card.state.selectedIndex=i;
			}
	}
	document.card.zipcode.value=newData[6];
	document.card.busnum1.value=newData[7];
	document.card.busnum2.value=newData[8];
	document.card.busnum3.value=newData[9];
	document.card.busnumext.value=newData[10];
	document.card.faxnum1.value=newData[11];
	document.card.faxnum2.value=newData[12];
	document.card.faxnum3.value=newData[13];
	document.card.dirnum1.value=newData[14];
	document.card.dirnum2.value=newData[15];
	document.card.dirnum3.value=newData[16];
	document.card.dirnumext.value=newData[17];
	document.card.resnum1.value=newData[18];
	document.card.resnum2.value=newData[19];
	document.card.resnum3.value=newData[20];
	document.card.tollfreenum1.value=newData[21];
	document.card.tollfreenum2.value=newData[22];
	document.card.tollfreenum3.value=newData[23];
	document.card.cellnum1.value=newData[24];
	document.card.cellnum2.value=newData[25];
	document.card.cellnum3.value=newData[26];
	document.card.oth1num1.value=newData[27];
	document.card.oth1num2.value=newData[28];
	document.card.oth1num3.value=newData[29];
	document.card.oth1numext.value=newData[30];
	document.card.oth2num1.value=newData[31];
	document.card.oth2num2.value=newData[32];
	document.card.oth2num3.value=newData[33];
	document.card.oth2numext.value=newData[34];
	document.card.website.value=newData[35];
	document.card.email.value=newData[36];
}
function remove(agent) {
	var answer = confirm("Are you sure you want to delete this agent?");
	if (answer) 
 	{
		window.location='viewagents.php?agent='+agent+'&del=1';
	}
 }
function removeitem(order) {

	if (confirm("Are you sure you want to remove this item from your cart?")) 
 	{
		window.location='viewcart.php?remove='+order;
 	} 
 }

