var counter=0;

var jscript = '';
jscript += '<script language="JavaScript">\n';
jscript += 'function priceClass() {\n';
jscript += '  for (var i = 0; i < arguments.length; ++i) {\n';
jscript += '    this[priceClass.arguments[i]] = new price();\n';
jscript += '  }\n';
jscript += '}\n';
  
jscript += 'function price() {\n';
jscript += '  this.none = null;\n';
jscript += '  this.metal = null;\n';
jscript += '  this.cherry = null;\n';
jscript += '  this.black = null;\n';
jscript += '}\n';

jscript += 'var prices = new priceClass("5x8","8x12","11x17","14x18","12x18","13x20","17x26","20x30","24x36","30x40","11x24","16x37","6x18","10x32","17x50");\n';

jscript += 'var size = new Array();\n';
jscript += 'var frame = new Array();\n';

jscript += 'frame["None"] = "none";\n'; 
jscript += 'frame["In Black Metal"] = "Black";\n';
jscript += 'frame["In Cherry Wood"] = "cherry";\n';
jscript += 'frame["In Black Wood"] = "black";\n';

jscript += 'size["5x8 SignedPrint"] = "5x8";\n';
jscript += 'size["8x12 Signed(matted at 14x18)"] = "8x12";\n';
jscript += 'size["11x17 Signed(matted at 14x18)"] = "11x17";\n'; 
jscript += 'size["14x18 Signed(DMatted at 14x18)"] = "14x18";\n'; 
jscript += 'size["12x18 SignedPrint"] = "12x18";\n';
jscript += 'size["13x20 SignedPrint"] = "13x20";\n';
jscript += 'size["17x26 SignedPrint"] = "17x26";\n';
jscript += 'size["20x30 SignedPrint"] = "20x30";\n';
jscript += 'size["24x36 SignedPrint"] = "24x36";\n';
jscript += 'size["30x40 SignedPrint"] = "30x40";\n';
jscript += 'size["11x24 4 Photos Framed"] = "11x24";\n';
jscript += 'size["16x37 4 Photos Framed"] = "16x37";\n';
jscript += 'size["6x18 SignedPrint"] = "6x18";\n';
jscript += 'size["10x32 SignedPrint"] = "10x32";\n';
jscript += 'size["17x50 SignedPrint"] = "17x50";\n';

jscript += 'prices["5x8"].none = "85.00";\n';
jscript += 'prices["5x8"].metal = "95.00";\n';
jscript += 'prices["5x8"].cherry = "95.00";\n';
jscript += 'prices["5x8"].black = "95.00";\n';

jscript += 'prices["8x12"].none = "13.95";\n';  
jscript += 'prices["8x12"].Black = "none";\n';
jscript += 'prices["8x12"].cherry = "none";\n';
jscript += 'prices["8x12"].black = "none";\n';
 
jscript += 'prices["14x18"].none = "65.00";\n';  
jscript += 'prices["14x18"].Black = "140.00";\n';
jscript += 'prices["14x18"].cherry = "150.00";\n';
jscript += 'prices["14x18"].black = "150.00";\n';

jscript += 'prices["12x18"].none = "125.00";\n'; 
jscript += 'prices["12x18"].Black = "240.00";\n';
jscript += 'prices["12x18"].cherry = "250.00";\n';
jscript += 'prices["12x18"].black = "250.00";\n';
 
jscript += 'prices["13x20"].none = "165.00";\n';
jscript += 'prices["13x20"].Black = "325.00";\n';
jscript += 'prices["13x20"].cherry = "335.00";\n';
jscript += 'prices["13x20"].black= "335.00";\n';

jscript += 'prices["17x26"].none = "195.00";\n';
jscript += 'prices["17x26"].Black = "375.00";\n';
jscript += 'prices["17x26"].cherry = "395.00";\n';
jscript += 'prices["17x26"].black = "395.00";\n';

jscript += 'prices["20x30"].none = "275.00";\n';
jscript += 'prices["20x30"].black = "575.00";\n';
jscript += 'prices["20x30"].cherry = "595.00";\n';
jscript += 'prices["20x30"].black = "595.00";\n';

jscript += 'prices["24x36"].none = "350.00";\n';
jscript += 'prices["24x36"].Black = "N/A.00";\n';
jscript += 'prices["24x36"].cherry = "775.00";\n';
jscript += 'prices["24x36"].black = "775.00";\n';

jscript += 'prices["30x40"].none = "425.00";\n';
jscript += 'prices["30x40"].Black = "N/A";\n';
jscript += 'prices["30x40"].cherry = "950.00";\n';
jscript += 'prices["30x40"].black = "950.00";\n';

jscript += 'prices["11x24"].none = " Framed only";\n';
jscript += 'prices["11x24"].Black = "185.00";\n';
jscript += 'prices["11x24"].cherry = "185.00";\n';
jscript += 'prices["11x24"].black = "185.00";\n';

jscript += 'prices["16x37"].none = " Framed only";\n';
jscript += 'prices["16x37"].Black = "395.00";\n';
jscript += 'prices["16x37"].cherry = "395.00";\n';
jscript += 'prices["16x37"].black = "395.00";\n';

jscript += 'prices["6x18"].none = "75.00";\n';
jscript += 'prices["6x18"].Black = "165.00";\n';
jscript += 'prices["6x18"].cherry = "175.00";\n';
jscript += 'prices["6x18"].black = "175.00";\n';

jscript += 'prices["10x32"].none = "175.00";\n';
jscript += 'prices["10x32"].Black = "375.00";\n';
jscript += 'prices["10x32"].cherry = "395.00";\n';
jscript += 'prices["10x32"].black = "395.00";\n';

jscript += 'prices["17x50"].none = "300.00";\n';
jscript += 'prices["17x50"].Black = "N/A";\n';
jscript += 'prices["17x50"].cherry = "895.00";\n';
jscript += 'prices["17x50"].black = "895.00";\n';

jscript += 'function calculate(form, picture) {\n';
jscript += '	if(document.layers){\n';
jscript += '		\/\/thisbrowser="NN4";\n';
jscript += '		pricetext = document.layers[picture];\n';
jscript += '	}\n';
jscript += '	if(document.all){\n';
jscript += '		\/\/thisbrowser="ie"\n';
jscript += '		pricetext = document.all[picture];\n';
jscript += '	}\n';
jscript += '	if(!document.all && document.getElementById){\n';
jscript += '		\/\/thisbrowser="NN6";\n';
jscript += '		pricetext = document.getElementById(picture);\n';
jscript += '	}\n';
jscript += '	eval("price = prices[\'" + size[form.os0.value] + "\']." + frame[form.os1.value]);\n';
jscript += '    if (form.os1.value != \'None\') {';
jscript += '            form.handling.value=\'12.00\'\n';
jscript += '    } else {\n';
jscript += '            form.handling.value=\'2\'\n';
jscript += '    }\n';
jscript += '	altercontent(picture, " Price: $" + price);\n';


jscript += '	eval("form.amount.value = prices[\'" + size[form.os0.value] + "\']." + frame[form.os1.value]);\n';
jscript += '}\n';

jscript += 'function altercontent(picture, price){\n';
jscript += '	\/\/if IE 4+\n';
jscript += '	if (document.all)\n';
jscript += '		document.all[picture].innerHTML=price;\n';
jscript += '	\/\/else if NS 4\n';
jscript += '	else if (document.layers){\n';
jscript += '		eval("document." + picture + ".document.write(price)");\n';
jscript += '		eval("document." + picture + ".document.close()");\n';
jscript += '	}\n';
jscript += '	\/\/else if NS 6 (supports new DOM)\n';
jscript += '	else if (document.getElementById){\n';
jscript += '		rng = document.createRange();\n';
jscript += '		el = document.getElementById(picture);\n';
jscript += '		rng.setStartBefore(el);\n';
jscript += '		htmlFrag = rng.createContextualFragment(price);\n';
jscript += '		while (el.hasChildNodes())\n';
jscript += '		el.removeChild(el.lastChild);\n';
jscript += '		el.appendChild(htmlFrag);\n';
jscript += '	}\n';

jscript += '}\n';
jscript += '<\/script>\n';


function getform(item,special) {
	var priceform = '';		
	priceform += '<form target="paypal" action="https:\/\/www.paypal.com\/cgi-bin\/webscr" method="post">\n';
	priceform += '<table>\n';
	priceform += '<tr>\n';
	priceform += '<td><input type="hidden" name="on0" value="Size">Size<\/td>\n';
	priceform += '<td><select name="os0" onChange="calculate(this.form, \'picture1\')">\n';
	priceform += '	<option value="" SELECTED>Make Selection<\/option>\n';
	if (!special) {
	//	priceform += '	<option value="5x8 SignedPrint">5x8 SignedPrint<\/option>\n';
	//	priceform += '	<option value="8x12 Signed(matted at 14x18)">8x12 Signed(matted at 14x18)<\/option>\n';
	// 	priceform += '	<option value="8x12 Signed(matted at 14x18)">06-07 UVa Calendar)<\/option>\n';		 
		priceform += '	<option value="14x18 Signed(DMatted at 14x18)">8x12 Signed(DoubleMat 14x18)<\/option>\n';
		priceform += '	<option value="12x18 SignedPrint">12x18 SignedPrint <\/option>\n';
		priceform += '	<option value="13x20 SignedPrint">13x20 SignedPrint <\/option>\n';
		priceform += '	<option value="17x26 SignedPrint">17x26 SignedPrint <\/option>\n';
		priceform += '	<option value="20x30 SignedPrint">20x30 SignedPrint <\/option>\n';
		priceform += '	<option value="24x36 SignedPrint">24x36 SignedPrint <\/option>\n';
		priceform += '	<option value="30x40 SignedPrint">30x40 SignedPrint <\/option>\n';
		priceform += '	<option value="11x24 4 Photos Framed">11x24 4 Photos Framed <\/option>\n';
		priceform += '	<option value="16x37 4 Photos Framed">16x37 4 Photos Framed <\/option>\n';
	} else {
		priceform += '	<option value="6x18 SignedPrint">6x18 SignedPrint DMatted<\/option>\n';
		priceform += '	<option value="10x32 SignedPrint">10x32 SignedPrint <\/option>\n';
		priceform += '	<option value="17x50 SignedPrint">17x50 SignedPrint <\/option>\n';


	}
	priceform += '<\/select>\n';
	priceform += '<\/td><\/tr>\n';

	priceform += '<tr>\n';
	priceform += '<td><input type="hidden" name="on1" value="DoubleMatt Framing">DoubleMatt Framing<\/td>\n';
	priceform += '<td><select name="os1" onChange="calculate(this.form, \'picture1\')">\n';
	priceform += '	<option value="None" SELECTED>None<\/option>\n';
	priceform += '	<option value="In Black Metal">In Black Metal<\/option>\n';
	priceform += '	<option value="In Cherry Wood">In Cherry Wood<\/option>\n';
	priceform += '	<option value="In Black Wood">In Black Wood<\/option>\n';
	priceform += '<\/select>\n';
	priceform += '<\/td><\/tr>\n';
	priceform += '<\/table>\n';
	priceform += '<div id="picture1">Price: $0.00<\/div>\n';

	priceform += '<input type="image" src="https:\/\/www.paypal.com\/en_US\/i\/btn\/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">\n';
	priceform += '<input type="hidden" name="add" value="1">\n';
	priceform += '<input type="hidden" name="cmd" value="_cart">\n';
	priceform += '<input type="hidden" name="business" value="jack@jcphotos.com">\n';
	priceform += '<input type="hidden" name="item_name" value="Photograph ' + item + '">\n';
	priceform += '<input type="hidden" name="amount" value="50.00">\n';
	priceform += '<input type="hidden" name="handling" value="">\n';
	priceform += '<input type="hidden" name="return" value="http://www.jcphotos.com\/thankyou.php">\n';
	priceform += '<input type="hidden" name="cancel_return" value="http://www.jcphotos.com\/cancel.php">\n';
	priceform += '<input type="hidden" name="no_note" value="1">\n';
	priceform += '<input type="hidden" name="currency_code" value="USD">\n';
	priceform += '<input type="hidden" name="lc" value="US">\n';
	priceform += '<br\/>Click "Make Selection" above to choose size , find prices and order photos.<br>(The checkout process is very easy, it does not require you to have or open a Paypal account.)<br>  Please go to the "Photo Prices" page for more pricing information, quality specifications, shipping and other info. <br> Email me with any special instructions,  You can include your phone # next to your name;--FedEx likes to have it.  <br><br>If you want to pick up your order, to avoid S&H charges,  please call.\n';  
	 
	priceform += '<\/form>\n';

	return priceform;
}

var basehref = '<base href="http:\/\/www.jcphotos.com/">\n';
var ctr = 0;

function openNote(topic,picture,desc,special){
	var winName = "win_"+(ctr++); //help open multiple windows
	var regexp = /\/(\w+)\./;

	item_array = picture.match(regexp)
	item_array[0] = item_array[0].replace(regexp, "$1");

	mypriceform = getform(item_array[0],special);
	  if (counter == 1) {
		counter = 0;
	  }
	  
        aPopUp= window.open('',winName,'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=500,height=450')
        ndoc=aPopUp.document 
        astr1 ='<HTML><HEAD><TITLE>' + topic + '</TITLE>';
	astr2 = basehref + '</HEAD><BODY bgcolor="#222222"text="FFFFFF"><CENTER><img src="' + picture + '" vspace=10><BR><B><I>' + topic + '</I></B></CENTER>';
	astr3 = '<P>'  + '</BODY></HTML>';
        ndoc.write(astr1);
	ndoc.write(jscript);
	ndoc.write(astr2);
	ndoc.write(mypriceform);
	ndoc.write(astr3);
        ndoc.close()
        self.aNoteWin = aPopUp
	  counter=1;
	  aPopUp.focus();
}



function openNote2(topic,picture,desc,special) {
	var regexp = /\/(\w+)\./;

	item_array = picture.match(regexp)
	item_array[0] = item_array[0].replace(regexp, "$1");

	mypriceform = getform(item_array[0],special);
	  if (counter == 1) {
		counter = 0;
	  }
	  if (counter == 1) {
		counter = 0; 
	  }
	  
        aPopUp= window.open('','Note','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=370,height=570')
        ndoc=aPopUp.document
        astr1 ='<HTML><HEAD><TITLE>' + topic + '</TITLE>';
	astr2 = basehref + '</HEAD><BODY bgcolor="#222222"text=#FFFFFF"><CENTER><img src="' + picture + '" vspace=10><BR><B><I>' + topic + '</I></B></CENTER>';
	astr3 ='<P>' + '</BODY></HTML>'
        ndoc.write(astr1);
	ndoc.write(jscript);
	ndoc.write(astr2);
	ndoc.write(mypriceform);
	ndoc.write(astr3);
        ndoc.close()
        self.aNoteWin = aPopUp
	  counter=1;

}
