//var newWindow;

var newfileName;
var dept;
var pnum;
var qty;
var orderspecs  = "";
var orderspecs2 = "";

function addcart(form) {

//alert("Add Cart" + form);	

	setvalue(form);
	
// alert("Back From setvalue");	

	cart_makeNewWindow();
//	subWrite();
}

function setvalue(form) {

	var name;

	 
//		pnum = (270 * 1) ;
		pnum = (form * 1) ;
			
			// contruct order specifications
			// copy out frame info   
	if (pnum == 270) {					// free membership
			orderspecs = " " ;
  			orderspecs += "Fill Out Your Customer Profile - Including Credit Card Info - Free of Charge." ;

			orderspecs2 = " " ;
			orderspecs2 += "To Enjoy The Many Benefits: Check Out Your Membership Order." ;
		
			return;
	}
		
	if (pnum == 271) {					// Professional Membership - Basic 
			orderspecs = " " ;
  			orderspecs += " To Enjoy The Many Benefits: Check Out Your Membership Order. Fill Out Your Customer Profile - Including Credit Card Info." ;

			orderspecs2 = " " ;
			orderspecs2 += 'Membership is for 1 year. Free shipping on orders above $50.00. Newsletter. 5 (12in x 12in) Proof prints for $10.00(plus shipping).' ;
		
			return;
	}
	if (pnum == 272) {					// Professional Membership - SILVER 
			orderspecs = " " ;
  			orderspecs += " To Enjoy The Many Benefits: Check Out Your Membership Order. Fill Out Your Customer Profile - Including Credit Card Info." ;

			orderspecs2 = " " ;
			orderspecs2 += 'Membership is for 1 year. Free shipping on orders above $50.00. Newsletter. 10 (12in x 12in) Proof prints for $10.00(plus shipping).' ;
		
			return;
	}
	if (pnum == 273) {					// Professional Membership - GOLD 
			orderspecs = " " ;
  			orderspecs += " To Enjoy The Many Benefits: Check Out Your Membership Order. Fill Out Your Customer Profile - Including Credit Card Info." ;

			orderspecs2 = " " ;
			orderspecs2 += 'Membership is for 1 year. Free shipping on orders above $50.00. Newsletter. 15 (12in x 12in) Proof prints for $10.00(plus shipping).' ;
		
			return;
	}
}

function cart_makeNewWindow() {
// alert("New Window");	
	if (newWindow && !newWindow.closed) {
		newWindow.close();
	}
	
	newWindow = window.open("","", "status, height=600, width=800, menubar,scrollbars, toolbar, resizable");		// open new window
	setTimeout("subWrite()",200);
}

function subWrite() {
// alert("subWrite");
	// make new window if someone has closed it
	if (newWindow.closed) {
		cart_makeNewWindow();
	}
	
	// bring window to front
	newWindow.focus();
	
	// assemble content for new window
	var newContent = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
	newContent += '<html xmlns="http://www.w3.org/1999/xhtml">';
	newContent += '<head>';
	newContent += '<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />';
	newContent += '<title>aaadd new window</title>';
	newContent += '</head>' ;

	
	newContent += '<body  bgcolor="#FFFFCC" text="#000000" onload = "document.cartadd.submit();">' ;
	//newContent += "<form name='cartadd' method='POST' action='https://store.printallimages.com/servlet/Cart' target = '_self'>";
	newContent += "<form name='cartadd' method='POST' action='http://store.printallimages.com/servlet/Cart' target = '_self'>";
	//<form name='cartadd' method='POST' action='http://store.printallimages.com/servlet/Cart' target = 'mainFrame'>
	newContent += '<input type="hidden" name="smode" value="add">';
	newContent += '<input type="hidden" name="product_no" value="';
	newContent += pnum ;
	newContent += '">';
	newContent += '<input type="hidden" name="basePrice" value="200">';

	newContent += '<table border="0" cellpadding="2" cellspacing="2">';
	newContent += '<tr>';

	newContent += '<td bgcolor="#999999">';
	newContent += '<div align= "center" >';
	newContent += 'ADDING YOUR ITEM TO SHOPPING CART -- PLEASE WAIT';
	newContent += '</div>';
	newContent += '</td>';


 	newContent += '</table>';

	newContent += '<p>';
	newContent += '<font face="Arial, Helvetica, sans-serif" color="black" size="2"><input type="hidden" name="qty" value="1" size="3"></font>';
	newContent += '</p>';

	newContent += '<p>';

	newContent += '<font face="Arial, Helvetica, sans-serif" color="black" size="2">';
	newContent += '<select name="color"  >';
		newContent += '<option id = "orderText" ';
		newContent += 'selected value="';
		newContent += orderspecs;
		newContent += '">';
		newContent += orderspecs;
		newContent += '</option>';
	newContent += '</select>';
	newContent += '</font>';
			newContent += '&nbsp;&nbsp;';
	
	
		newContent += '<font face="Arial, Helvetica, sans-serif" color="black" size="2">';
		newContent += '<select name="size">';


			newContent += '<option value="Qty">Qty</option>';
			newContent += '<option  selected value="';
			newContent += orderspecs2;
			newContent += '">';
			newContent += orderspecs2;
			newContent += '</option>';
		newContent += '</select>';
		newContent += '</font>';
	
	
	

		newContent += '</p>';

//		newContent += '<p><input type="submit"  border="0" alt="Buy It"></p>';
		newContent += '</form>';

		newContent += '</body>';
		newContent += '</html>';
	

		// write HTML to new window document
		newWindow.document.write(newContent);
		newWindow.document.close();						// close layout stream

}


