<!-- Code that adds a "Print with Photobox or Shutterfly" link to slide images.
     These services prints images and delivers them to your door.
-->

<%!
	String productUrl;
	String postUrl;
	if (printing == void) printing = "none";
	
	if (printing.equals("photobox")) {
    productUrl = "www.photobox.co.uk";
	}
	else if (printing.equals("digibug")) {
    productUrl = "www.digibug.com";
	}
	else {
    productUrl = "shutterfly.com";
	}
%>

<ja:switch test="$printing">
    <ja:case value="snapgalaxy">
        <% if (partnerId == void) partnerId = "default"; %>
        <script type="text/javascript">
        function submitOrderForm()
	        {
	    	if (location.protocol != 'http:') alert("Ordering prints on-line requires this album to be hosted on a public web server.\n" +
	    	 "Use the JAlbum publish section to publish this album.");
	    	else {
	    	    form = document.forms['orderform'];
	    	    location = window.location;
	    	    form.returnurl.value = location.href;
	    	    form.addmoreurl.value = location.href;
	    	    href = location.href;
	    	    form["image_1"].value = href.substring(0,href.lastIndexOf("slides/")) + form.toImage.value;
	    	    form["thumb_1"].value = href.substring(0,href.lastIndexOf("slides/")) + form.toThumb.value;
	    	    form["cssurl"].value = href.substring(0, href.lastIndexOf("slides/")) + "/res/styles.css";    
	    	    form.submit();
	    	}
        }
        </script>
        <form action="http://www.snapgalaxy.com/jalbum/" method="post" name="orderform">
    	<p>
    	<input type="hidden" name="version" value="100">
    	<input type="hidden" name="referid" value="JALBUM">
    	<input type="hidden" name="partnerid" value="${partnerId}">
    	<input type="hidden" name="cmd" value="addimg">       
    	<input type="hidden" name="imagecount" value="1">
    	<input type="hidden" name="image_1" value="REPLACE_ME">
    	<ja:if exists="originalPath">
    	<input type="hidden" name="imagewidth_1" value="$originalWidth">
    	<input type="hidden" name="imageheight_1" value="$originalHeight">
    	<input type="hidden" name="toImage" value="$fileName">
    	</ja:if>
    	<ja:else>
    	<input type="hidden" name="imagewidth_1" value="$imageWidth">
    	<input type="hidden" name="imageheight_1" value="$imageHeight">
    	<ja:if test="<%= engine.getImageLinking().equals("LinkOriginals") %>">
    	    <input type="hidden" name="toImage" value="$fileName">
    	</ja:if>
    	<ja:else>
    	    <input type="hidden" name="toImage" value="slides/$fileName">
    	</ja:else>
    	</ja:else>
    	<input type="hidden" name="thumb_1" value="REPLACE_ME">
    	<input type="hidden" name="thumbwidth_1" value="$thumbWidth">
    	<input type="hidden" name="thumbheight_1" value="$thumbHeight">
    	<input type="hidden" name="returnurl" value="REPLACE_ME">        
    	<input type="hidden" name="addmoreurl" value="REPLACE_ME">
    	<input type="hidden" name="fromSlides" value="slides/$currentPage">
    	<input type="hidden" name="toThumb" value="thumbs/$fileName">
    	<input type="hidden" name="cssurl" value="REPLACE_ME">
    	</p>
        </form>
    </ja:case>

    <ja:case value="shutterfly">

    	<script type="text/javascript">
    	function submitOrderForm()
    	{
	        if (location.protocol != 'http:') alert("Ordering prints on-line requires this album to be hosted on a public web server.\n" +
	         "Use the JAlbum publish section to publish this album.");
	        else {
	        	form = document.forms['orderform'];
	        	location = window.location;
	        	form.returl.value = location.href;
	        	href = location.href;
	        	form["imraw-1"].value = href.substring(0,href.lastIndexOf("slides/")) + form.toImage.value;
	        	form["imthumb-1"].value = href.substring(0,href.lastIndexOf("slides/")) + form.toThumb.value;
	        	form.submit();
	        }
    	}
    	</script>

    	<form name="orderform" action="http://www.shutterfly.com/c4p/UpdateCart.jsp" method="post">
        <p>
        <input type="hidden" name="addim" value="1">
        <input type="hidden" name="protocol" value="SFP,100">
        <input type="hidden" name="pid" value="C4PP">
        <input type="hidden" name="psid" value="JALB">
        <input type="hidden" name="imnum" value="1">
        <input type="hidden" name="imraw-1" value="REPLACE_ME">
        <ja:if exists="originalPath">
        <input type="hidden" name="imrawwidth-1" value="$originalWidth">
        <input type="hidden" name="imrawheight-1" value="$originalHeight">
        <input type="hidden" name="toImage" value="$fileName">
        </ja:if>
        <ja:else>
        <input type="hidden" name="imrawwidth-1" value="$imageWidth">
        <input type="hidden" name="imrawheight-1" value="$imageHeight">
        <ja:if test="<%= engine.getImageLinking().equals("LinkOriginals") %>">
        	<input type="hidden" name="toImage" value="$fileName">
        </ja:if>
        <ja:else>
        	<input type="hidden" name="toImage" value="slides/$fileName">

        </ja:else>
        </ja:else>
        <input type="hidden" name="imthumb-1" value="REPLACE_ME">
        <input type="hidden" name="imthumbwidth-1" value="$thumbWidth">
        <input type="hidden" name="imthumbheight-1" value="$thumbHeight">
        <input type="hidden" name="returl" value="REPLACE_ME">

        <input type="hidden" name="fromSlides" value="slides/$currentPage">
        <input type="hidden" name="toThumb" value="thumbs/$fileName">
        </p>
    	</form>
    </ja:case>


    <ja:case value="digibug">
      <% if (companyId == void) {
        window.messageBox("Please define companyId as a user defined variable under the Advanced tab");
        companyId = 0;
         }
      %>

        <script type="text/javascript">
        function submitOrderForm()
	        {
	    	if (location.protocol != 'http:') alert("Ordering prints on-line requires this album to be hosted on a public web server.\n" +
	    	 "Use the JAlbum publish section to publish this album.");
	    	else {
	    	    form = document.forms['orderform'];
	    	    location = window.location;
	    	    form.return_url.value = location.href;
	    	    href = location.href;
	    	    form["image_1"].value = href.substring(0,href.lastIndexOf("slides/")) + form.toImage.value;
	    	    form["thumb_1"].value = href.substring(0,href.lastIndexOf("slides/")) + form.toThumb.value;
	    	    form.submit();
	    	}
        }
        </script>

        <form action="http://www.digibug.com/dapi/order.php" method="post" name="orderform">
    	<p>
    	<input type="hidden" name="digibug_api_version" value="100">
    	<input type="hidden" name="partner_code" value="67">
    	<input type="hidden" name="company_id" value="$companyId">
    	<input type="hidden" name="event_id" value="$eventId">
    	<input type="hidden" name="cmd" value="addimg">
    	<input type="hidden" name="num_images" value="1">
    	<input type="hidden" name="image_1" value="REPLACE_ME">
    	<ja:if exists="originalPath">
    	<input type="hidden" name="image_width_1" value="$originalWidth">
    	<input type="hidden" name="image_height_1" value="$originalHeight">
    	<input type="hidden" name="toImage" value="$fileName">
    	</ja:if>
    	<ja:else>
    	<input type="hidden" name="image_width_1" value="$imageWidth">
    	<input type="hidden" name="image_height_1" value="$imageHeight">
    	<ja:if test="<%= engine.getImageLinking().equals("LinkOriginals") %>">
    	    <input type="hidden" name="toImage" value="$fileName">
    	</ja:if>
    	<ja:else>
    	    <input type="hidden" name="toImage" value="slides/$fileName">
    	</ja:else>
    	</ja:else>
    	<input type="hidden" name="thumb_1" value="REPLACE_ME">
    	<input type="hidden" name="thumb_width_1" value="$thumbWidth">
    	<input type="hidden" name="thumb_height_1" value="$thumbHeight">
    	<input type="hidden" name="return_url" value="REPLACE_ME">
    	<input type="hidden" name="fromSlides" value="slides/$currentPage">
    	<input type="hidden" name="toThumb" value="thumbs/$fileName">
    	</p>
        </form>
    </ja:case>
</ja:switch>