// JavaScript Document



	//added rollover images feature 5/1/05
	function MM_swapImgRestore() { //v3.0
		var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_preloadImages() { //v3.0
		var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_findObj(n, d) { //v4.01
		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
		var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}



	//fill in the shipping info
	function fill_shipping_info(me)
	{
		var form = document.offline_form;
		if (me.checked)
		{
			form.shipping_name.value = form.name.value;
			form.shipping_address1.value = form.address1.value;
			form.shipping_address2.value = form.address2.value;
			form.shipping_city.value = form.city.value;
			form.shipping_state.value = form.state.value;
			form.shipping_zip.value = form.zip.value;
			form.shipping_country.value = form.country.value;
			form.shipping_phone.value = form.phone.value;
		}
		else
		{
			form.shipping_name.value = "";
			form.shipping_address1.value = "";
			form.shipping_address2.value = "";
			form.shipping_city.value = "";
			form.shipping_state.value = "";
			form.shipping_zip.value = "";
			form.shipping_country.value = "";
			form.shipping_phone.value = "";
		}
	}
	
	
	function fill_shipping_concord(me)
	{
		var form = document.order_form;
		if (me.checked)
		{
			form.shipping_name.value = form.first_name.value + " " + form.last_name.value;
			form.shipping_address1.value = form.address.value;
			form.shipping_address2.value = form.address1.value;
			form.shipping_city.value = form.city.value;
			form.shipping_state.value = form.state.value;
			form.shipping_zip.value = form.zip.value;
			form.shipping_country.value = form.country.value;
			form.shipping_phone.value = form.phone.value;
			form.shipping_email.value = form.email.value;
		}
		else
		{
			form.shipping_name.value = "";
			form.shipping_address1.value = "";
			form.shipping_address2.value = "";
			form.shipping_city.value = "";
			form.shipping_state.value = "";
			form.shipping_zip.value = "";
			form.shipping_country.value = "";
			form.shipping_phone.value = "";
			form.shipping_country.value = "";
			form.shipping_phone.value = "";
			form.shipping_email.value = "";
		}
	}
	

	function update_basket(product_name, id)
	{
		alert(id);
	}
	
	function view_invoice()
	{
		var form = document.invoice_form;
		
		Item = form.username.selectedIndex;
		
		var file = "view_invoice.php?username=" + form.username.value + "&order_id=" +form.username.options[Item].text;
		
		var hnwd = launchCenter(file, "VIEWREPORT", 600, 500, true, true );
	}
		
	function print_invoice(invoice)
	{
		var file = "print_invoice.php?order_id=" + invoice;
		
		var hnwd = launchCenter(file, "VIEWREPORT", 600, 500, true, true );
	}
	
	
	function include_subcategory(me)
	{
		var form = document.pricing;
		
		if ( me.checked )
		{
			form.start_from.value = "";
			form.rows.value = "";
			
			form.start_from.disabled = true;
			form.rows.disabled = true;
		}
		else
		{
			form.start_from.disabled = false;
			form.rows.disabled = false;
		}
	}
	
	
	function view_report(print_option)
	{
		var form = document.report_form;
		
		var file = "view_report.php?status=" + form.status.value + "&from="+form.from.value+"&to="+form.to.value+"&print="+print_option+"&report_name="+form.report_name.value;
		
		var hnwd = launchCenter(file, "VIEWREPORT", 600, 700, true, true );
	}
	
	function send_to_friend(id)
	{
		var file = "refer_to_friend.php?media_id=" + id;
		var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 500, false, false );
	}
	
	function send_to_friend_from_private_gallery(id)
	{
		var file = "refer_to_friend.php?media_id=" + id + "&private_gallery=1";
		var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 500, false, false );
	}
	
	function send_lightbox(sesion)
	{
		var file = "send_lightbox.php?session=" + sesion;
		var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 500, false, false );
	}
	
	
	function send_hidden_lightbox(hidden_code)
	{		
		var file = "send_hidden_lightbox.php?hidden_code=" + hidden_code;		
		var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 500, false, false );
	}
	
	function send_private_lightbox(session)
	{
		var file = "send_lightbox.php?session=" + session + "&private_gallery=1";		
		var hnwd = launchCenter(file, "SENDTOFRIEND", 400, 500, false, false );
	}
	
	function send_hidden_friend(hidden_code)
	{
		var file = "send_hidden_gallery.php?hidden_code=" + hidden_code;
		var hnwd = launchCenter(file, "SENDHIDDEN", 400, 500, false, false );
	}
	
	function close_window()
	{						
		window.opener.document.location.reload();

		window.close();
	}

	
	function open_iptc(id)
	{
		var file = "iptc.php?id=" + id;
		var hnwd = launchCenter(file, "IPTC", 650, 450, true, true );
	}
	

	function empty_lightbox(message, url)
	{
		var answer = confirm(message);
		

		if ( answer == true)
		{
			if ( url != "" )
			{
				url = url + "?pageId=2000";
				window.open(url, '_top');
			}
			else
			{
				url = "index.php?pageId=2000";
				window.open(url, '_top');
			}
		}		
	}

	

	function popup_agreement()
	{
		var browse = "agreement.php";

		var hnwd = launchCenter(browse, "AGREEMENT", 600, 450, true, false );	
	}

	

	function get_link(category)
	{
		var url = "get_link.php?category="+category;

		var hnwd = launchCenter(url, "POPUP", 100,400, false, false);
	}

	

	

	function onhelp()
	{
		var browse = "help.html";

		window.open(browse,'popup', 'resizable=yes,status=no,toolbar=no,scrollbars=yes,location=no,menu=no,width=550,height=700');  
	}

	

	function ccv2()
	{
		var browse = "card_info_pop.htm";

		var hnwd = launchCenter(browse, 'popup', 620, 500, true, false);  

	}



	function upload_new_watermark()
	{
		var browse = "upload_logo.php";

		var hnwd = launchCenter(browse, "LOGO", 120, 510, false );	
	}

	

	function popupBrowsewin( )
	{	
		var browse = "download_browse.php";

		var hnwd = launchCenter(browse, "DownloadBrowse", 400, 300, false );	
	}

	

	function show_icon(sel)
	{
		var form = document.category;

		form.showIcon.src = sel.options[sel.selectedIndex].value;
	}

	

	

	function upload_download_image(id, name, check)
	{
		var file;
		if ( check.checked )
		{
			 file = "upload.php?id="+id+"&name="+name+"&act=rem";
		}
		else
		{
			file = "upload.php?id="+id+"&name="+name+"&act=add";
		}


		var opener = launchCenter(file, "LOGO", 120, 500, false);
	}

	

	function launchCenter(url, name, height, width, resize, scrollbar) 
	{
	 	var str = "height=" + height + ",innerHeight=" + height;

		if ( resize )
		{
  			str += ",width=" + width + ",innerWidth=" + width + ",resizable=yes";
		}
		else
		{
			str += ",width=" + width + ",innerWidth=" + width;
		}
		
		
		if ( scrollbar )
		{
			str += ",scrollbars=yes";
		}

		

		if (window.screen) 
		{
			var ah = screen.availHeight - 30;

		    var aw = screen.availWidth - 10;



		    var xc = (aw - width) / 2;

		    var yc = (ah - height) / 2;



		    str += ",left=" + xc + ",screenX=" + xc;

		    str += ",top=" + yc + ",screenY=" + yc;
		}

		

	  return window.open(url, name, str);
	}

