function enableBillingAddr(form_ref) {
	if (form_ref.shipping_chk.checked) {
		form_ref.shipping_firstname.disabled = false;
		form_ref.shipping_lastname.disabled = false;
		form_ref.shipping_company.disabled = false;
		form_ref.shipping_street_address.disabled = false;
		form_ref.shipping_street_address2.disabled = false;
		form_ref.shipping_city.disabled = false;
		form_ref.shipping_zone_id.disabled = false;
		form_ref.shipping_country.disabled = false;
		form_ref.shipping_postcode.disabled = false;
		form_ref.shipping_dphone1.disabled = false;
		form_ref.shipping_dphone2.disabled = false;
		form_ref.shipping_dphone3.disabled = false;
		form_ref.shipping_fax1.disabled = false;
		form_ref.shipping_fax2.disabled = false;
		form_ref.shipping_fax3.disabled = false;

	} else {
		form_ref.shipping_firstname.disabled = true;
		form_ref.shipping_lastname.disabled = true;
		form_ref.shipping_company.disabled = true;
		form_ref.shipping_street_address.disabled = true;
		form_ref.shipping_street_address2.disabled = true;
		form_ref.shipping_city.disabled = true;
		form_ref.shipping_zone_id.disabled = true;
		form_ref.shipping_country.disabled = true;
		form_ref.shipping_postcode.disabled = true;
		form_ref.shipping_dphone1.disabled = true;
		form_ref.shipping_dphone2.disabled = true;
		form_ref.shipping_dphone3.disabled = true;
		form_ref.shipping_fax1.disabled = true;
		form_ref.shipping_fax2.disabled = true;
		form_ref.shipping_fax3.disabled = true;
	}
}


/**
  TWD
  DC
	8-23-06
	launch detail popups

*/

function launchSelectWins(path){
	if(path=="selections"||path=="top"){
		if(navigator.appVersion.match("Safari")){
			var filenamestart=location.href.lastIndexOf("/")+1;
			var hashstart=location.href.indexOf("#");
			//alert(hashstart);
			if(hashstart==-1){
				var filepart=location.href.substring(filenamestart);
			}else{
				var filepart=location.href.substring(filenamestart,hashstart);
			}
			//alert("More Safari Jumping down the page");
			//alert(filepart);
			//alert(path);
			location.replace(filepart+"#"+path);
		}else{
			//just jump down the page
			var temphash=location.hash;
			location.hash=path;
			//set the hash back in case it holds the sku
			//alert(temphash);
			if(temphash.indexOf("sku")!=-1){
				location.hash=temphash;
			}
		}
	}else{
		//alert(path);
		// if you change these params, change them in the vbscript code in
		// product_info.php
		window.open(path, 'Win', 'toolbar=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,width=585,height=575');
	}
}

function launchMyGalleryAdd(pid,printRec,frameRec,mlRec){
	//launches the my gallery popup with the proper parameters
	//alert("Launch the gallery");
	if(pid.indexOf(",")!=-1){
		//alert("splitting arg");
		arglist=pid.split(",");
		pid=arglist[0];
		printRec=arglist[1];
		frameRec=arglist[2];
		mlRec=arglist[3];
	}
	var params = "?products_id=" + pid + "&print_record=" + printRec + "&frame_record=" + frameRec + "&matt_or_liner=" + mlRec;
	window.open('my_gallery_add_pop.php' + params,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=570,height=550,screenX=150,screenY=150,top=150,left=150')

}


function saveRecordString(printRec,frameRec,mlRec){
	dhtmlHistory.add("sku:"+printRec+"-"+frameRec+"-"+mlRec);
}
function parseRecProps(){
	//alert(document.location.search);
	var hashString=document.location.hash;
	if(hashString=="" || hashString.indexOf("sku:")==-1){
		return "";
	}else{
		return(hashString.substr(5));
	}
}

function initializeSKUtrack() {
            // initialize our DHTML history
            dhtmlHistory.initialize();
            // subscribe to DHTML history change
            // events
            /*dhtmlHistory.addListener(
                                   historyChange);

*/
            // if this is the first time we have
            // loaded the page...

}

/*scripts for using Kevin Lynches methiod for saving state,
//integrating with BrowserState.as*/
function flashPutHref(href) {
	var filenamestart=location.href.lastIndexOf("/")+1;
	var hashstart=location.href.indexOf("#");
	//alert(hashstart);
	if(hashstart==-1){
		var filepart=location.href.substring(filenamestart);
	}else{
		var filepart=location.href.substring(filenamestart,hashstart);
	}

	//alert(filepart);
	//jump back to the top with every selection
	if(navigator.appVersion.match("Safari")){
		// for some reason, two quick replacements don't work
		window.scrollTo(0,0);
	}else{
		location.replace(filepart+"#top");
	}
	location.replace(filepart+href);
	}
function flashPutTitle(title) { document.title = title; }

function showFlash(swf, w, h,flVars)
	{
		//alert(document.location);
		var isMSIE = navigator.appName.indexOf("Microsoft") != -1;
		var l1 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" id="flashapp" align="">'
		var l2 = '<param name="movie" value="'+swf+'" />'
		var l3 = '<param name="menu" value="false" />'
		var l4 = '<param name="quality" value="best" /><param name="Wmode" value="transparent" />'
		var l5 = '<param name="FlashVars" value="initialURL='+escape(document.location)+'&isMSIE='+isMSIE+flVars+'" />'
		var l6 = '<embed src="'+swf+'" FlashVars="initialURL='+escape(document.location)+'&isMSIE='+isMSIE+flVars+'" menu="false" quality="best" width="'+w+'" height="'+h+'" name="flashapp" align="" Wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>'
		document.write(l1+l2+l3+l4+l5+l6);
	}