// Picwin
function picwin(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin,PicID,Picdesc,Picjpeg,Picorient,numofsizes,size1,price1,shipping1,size2,price2,shipping2,size3,price3,shipping3,PicLongdesc) 
//____________________________________________________________________________________________________________________________________

//function picwin(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin)
{
	if (bgcolor=="") 
	{
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740)
	{
	  var lift=0.90;
	}
	if(w>=740 & w<835)
	{
	  var lift=0.91;
	}
	
	if(w>=835)
	{
	  var lift=0.93;
	}
	if (imageWidth>w)
	{	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj)
	{
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight)
	{
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image")
	{
	  if (hugMargin == "")
	  {
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) 
	  {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) 
	  {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj)
	{
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1)
	{
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else 
	{

//____________________________________________________________________________________
//       
//   Read in all of the  data passed from the calling program and fill the variables listed above...
//  Remember - the  variables are case sensitive.
//
//
//____________________________________________________________________________________
	var out1 = '';
	var out2 = '';
	var out3 = '';
	var out4 = '';
	var shipping = '0.00';
	var picsize = '' ;
	var mywebsite = 'http://www.acartwrightstudio.com';
	var PicHW       = '';
//	var PicjpegW   =  mywebsite+Picjpeg ;

	PicHW = "WIDTH=231,HEIGHT=355" ;
	if (Picorient != 'P') {  PicHW = 'WIDTH=355,HEIGHT=231' ; }

	var picline = '<span class="PicName">'+ Picdesc+'</span><br>';
	var picline2 = '<div align="center" valign="middle"> <img src="/'+ Picjpeg +'" '+ PicHW +' > </div>' ;
  	var outb = '<select name="PRODUCTSELECTOR">' ;
   
	out1 = "<option name='" + Picdesc + "' cost='" + price1 + "' id_num='" + PicID + "' picsize='" + size1 + "' shipping='" + shipping1 + "'>"  + size1 + "  -  $" + price1 + " </option>"; 
	if (size2 != null) 
	{  out2 = "<option name='" + Picdesc + "' cost='" + price2 + "' id_num='" + PicID + "' picsize='" + size2 + "' shipping='" + shipping2 + "'>"  + size2 + "  -  $" + price2 + " </option>"} ;
	if (size3 != null) 
	{  out3 = "<option name='" + Picdesc + "' cost='" + price3 + "' id_num='" + PicID + "' picsize='" + size3 + "' shipping='" + shipping3 + "'>"  + size3 + "  -  $" + price3 + " </option>" }; 
	
	newWindow = window.open("../Empty.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.write('while(!newWindow.document){// wait for window to open... } ') ;
  
	newWindow.document.open();
	newWindow.document.write('<html><head><title>'+PicID+'</title>') ;
	newWindow.document.write('<style type="text/css">body {	background-color: #000000;}--></style>') ;
	newWindow.document.write('<SCRIPT SRC="/language-en.js" type="text/JavaScript"></SCRIPT>') ; 
  	newWindow.document.write('<SCRIPT SRC="/nopcart.js" type="text/JavaScript"></SCRIPT>') ; 
	newWindow.document.write('<link rel="stylesheet" type="text/css" href="/ACS.css">') ;
	newWindow.document.write('</head>' ) ;
	newWindow.document.write('<body>' ) ;
	newWindow.document.write('<!-- #BeginLibraryItem "/Library/ACSBuyHeader.lbi" --><table width="900" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#000000">');
	newWindow.document.write('<tr><td width="900" height="85" bgcolor="#FFFFFF"><div class="style1" style="border-style: dashed; border-width: 0px; background-color: #FFFFF0">');
	newWindow.document.write('<p align="center"> <img border="0" src="/BANNERS/ACBUYBANNER.jpg" width="900" height="85"></p>');
	newWindow.document.write('</div></td></tr></table><!-- #EndLibraryItem -->') ;
	
	newWindow.document.write('<table width="900"  border="1" align="center" cellpadding="1" cellspacing="1" bgcolor="#000000">') ;
  	newWindow.document.write('<tr>');
   	newWindow.document.write('<td width="40%" height="420">') ;
	newWindow.document.write(picline2) ;
	newWindow.document.write('</td>');
    newWindow.document.write('<td width="60%" align="center" valign="top"><br><br><br>');
    newWindow.document.write(picline) ;
    newWindow.document.write('</p><p>');
//  Loop through the long description parsing the ##s	
	if ((PicLongdesc !="") && (PicLongdesc!=null))
	{
	  var desc_array=PicLongdesc.split("##");
	var part_num=0;
	while (part_num < desc_array.length)
	 {
  	 if (part_num == 0) { newWindow.document.write('<span class="x-small">'+ desc_array[part_num]+ '</span><br>' ) ;}
 	 if (part_num == 1) { newWindow.document.write('<span class="medium">'+ desc_array[part_num]+ '<br>' ); } 
	 if (part_num >= 2) { newWindow.document.write('<br>'+desc_array[part_num]+ '</span><br>') ; }
 	      part_num+=1;
	 }	
	}
		 	
	newWindow.document.write('</p><p>&nbsp;</p>'); 
	
     newWindow.document.write('<form name="order" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">');
     newWindow.document.write('<input type="hidden" name="cmd" value="_cart">');
     newWindow.document.write('<input type="hidden" name="business" value="acstudio@acartwrightstudio.com">');
     newWindow.document.write('<input type="hidden" name="undefined_quantity" value="1">');
     newWindow.document.write('<input type="hidden" name="item_name" value="'+Picdesc+'">');
//	newWindow.document.write('<input type="hidden" name="item_number" value="'+PicID+'"> ') ;
		newWindow.document.write('<input type="hidden" name="item_number" value=""> ') ;

	newWindow.document.write('<input type="hidden" name="image_url" value="http://www.acartwrightstudio.com/BANNERS/ACPAYPALLOGO.jpg">') ;
	newWindow.document.write('<input type="hidden" name="return" value="http://www.acartwrightstudio.com/home.htm">') ;
	newWindow.document.write('<input type="hidden" name="cancel_return" value="http://www.acartwrightstudio.com/home.htm">') ;
	newWindow.document.write('<input type="hidden" name="shipping" value="'+shipping+'">');
	newWindow.document.write('<input type="hidden" name="currency_code" value="USD">') ;
	newWindow.document.write('<input type="hidden" name="picsize" value=" ">');

	newWindow.document.write('<input type="hidden" name="on0" value="Size">') ;
//	newWindow.document.write('<input type="hidden" name="os0" value="'+picsize+'">') ;
	newWindow.document.write('<input type="hidden" name="os0" value=" ">') ;

	newWindow.document.write('<input type="hidden" name="add" value="1">') ;
	newWindow.document.write('<input type="hidden" name="amount" value="">') ;
		if (size2 != ' ') {
	    newWindow.document.write('<span class="style3"><font color="#FFFCCE" face="Tahoma">Please select a size: '); }
        newWindow.document.write('</font></span><br>');
		newWindow.document.write(outb);

//	newWindow.document.write(outa ) ;
//	if(size2 != ' ') { newWindow.document.write('<font color="#FFFCCE" face="Tahoma">Please select a size:'<br></font>') } ;
//	newWindow.document.write(outb ) ;
//	newWindow.document.write(outc ) ;
	newWindow.document.write(out1 ) ;
	if (size2 != ' ') {
		newWindow.document.write(out2) ; }
	if (size3 != ' ') {
		newWindow.document.write(out3) ; }

	newWindow.document.write('</select>') ;


	newWindow.document.write('<p><br><br><font color="#FFFCCE" face="Tahoma"><span class="style3">Quantity:</span>') ;
	newWindow.document.write('<input type=text size=1 maxlength=1 name=quantity onChange="this.value=CKquantity(this.value)" value="1" >') ;
 	newWindow.document.write('<br><br>') ;
	//	newWindow.document.write('<input type="image" name="buy" onClick="AddOneOfManyToCart(this.form)" src="/Symbols/addtobag2.gif" value="Add to Cart" alt="PayPal - Secure Order">') ;
	newWindow.document.write('<input type="image" onClick="AddOneOfManyToCart(this.form)" src="/Symbols/AddtoCart.jpg" name="buy2" WIDTH="69" HEIGHT="22" border=0 value="Add to Cart" ALT="Add to Cart" align=top> ') ;
 //       newWindow.document.write('<a href="javascript:onClick=AddOneOfManyToCart(this.form)"> <img src="/Symbols/addtobag2.gif" value="Add to Cart" alt="PayPal - Secure Order"></a> ') ;

	newWindow.document.write('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#FFFCCE" face="Tahoma">') ;
	newWindow.document.write('<input type="button" name="Button" value="Close Window" onClick="window.close();">') ;
	newWindow.document.write('</font></p><p>&nbsp;</p>');
	newWindow.document.write('</form></table>');
	newWindow.document.write('<!-- #BeginLibraryItem "/Library/StatCounter.lbi" -->');
	newWindow.document.write('<!-- Start of StatCounter Code -->');
	newWindow.document.write('<script type="text/javascript" language="javascript">');
	newWindow.document.write('var sc_project=791612; ');
	newWindow.document.write('var sc_partition=6; ');
	newWindow.document.write('var sc_security="19f9be39"; ');
	newWindow.document.write('var sc_invisible=1; ');
	newWindow.document.write('</script>');
	newWindow.document.write('<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script>');
	newWindow.document.write('<noscript>');
	newWindow.document.write('<a href="http://www.statcounter.com/" target="_blank"><img  src="http://c7.statcounter.com/counter.php?sc_project=791612&amp;java=0&amp;security=19f9be39&amp;invisible=1" alt="counter statistics" border="0"></a>');
	newWindow.document.write('</noscript>');
	newWindow.document.write('<!-- End of StatCounter Code --><!-- #EndLibraryItem -->');
		  newWindow.focus();
	}
return ;}