var sports_shipArray = new Array(".5","1","5","1.25","5","1.5","1.5","6","6","7","6","1","6","8","8","8");
var wed_shipArray = new Array("1","1","0","1","2","5","5","6","8","8","8","1","1");
var port_shipArray = new Array("1","1","0","1","2","5","5","6","8","8","8","1","1");
var gen_shipArray = new Array("1","2","1","2","0","1","2","2","5","5","6","8","8","8","1","1");
var senior_shipArray = new Array("1","1","1","2","2","2","2","10","10","10","20","20","20","25","25","25","25","30","30","30","40");
var com_shipArray = new Array("1","0","1","5","1","1");
var shippingArray = new Array();

function adjustVals (ppform){
	switch(ppform.type.value) {
		case 'wed':
		  shippingArray = wed_shipArray;
		  break;
		case 'sports':
		  shippingArray = sports_shipArray;
		  break;
		case 'port':
		  shippingArray = port_shipArray;
		  break;
		case 'gen':
		  shippingArray = gen_shipArray;
		  break;
		case 'com':
		  shippingArray = com_shipArray;
		  break;
		case 'senior':
		  shippingArray = senior_shipArray;
		  break;
		default:
		  shippingArray = gen_shipArray;
	}
	
	if (ppform.localPickup.value == 'true' && ppform.shippingLocal.checked) {
		ppform.shipping.value = 0;
		ppform.on0.value = ppform.amount.options[ppform.amount.selectedIndex].text + ' Local Pickup';			
	} 
	else {
		ppform.on0.value = ppform.amount.options[ppform.amount.selectedIndex].text
		if (ppform.flatRateShipping.value == 'false'){
			ppform.shipping.value = shippingArray[ppform.amount.selectedIndex];
		}	
	}
	return true;
}

function displaymessage() {
   var url = window.location.href;
   
   if (url.indexOf("http://fotografixstudio.com/?page_id=974") == -1 && url.indexOf("http://fotografixstudio.com/?page_id=976") == -1) {
      var d = new Date();
	  alert("NOTICE OF COPYRIGHT\n\nCopyright \u00A9 " + d.getFullYear() + " Fotografix Studio\n\nAll content contained within this site is protected by copyright\nlaws. Unauthorized use of our material is strictly prohibited.\n\nPlease contact the studio if you would like to order\nenlargements of this image.");
      return false;
   }
}

function showawaymessage() {
	var url = window.location.href;
	if(false) {
	var x = readCookie('awaynag')
	if(x) {
		// do nothing
	} else {
		if (url != "http://fotografixstudio.com/" && url.indexOf("http://fotografixstudio.com/?page_id=22") == -1 && url.indexOf("http://fotografixstudio.com/?page_id=24") == -1 && url.indexOf("http://fotografixstudio.com/?page_id=26") == -1 && url.indexOf("http://fotografixstudio.com/?page_id=28") == -1) {
			alert("ATTENTION!\n\nFotografix Studio will be closed from April 18th through April 26th\n\nAny orders placed during this period will be processed after April the 26th.\n\nWe apologize for any inconvience this may cause.");
			createCookie("awaynag", "yes", 2);
		}
	}
	}
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
