﻿
var imagePath = "/images/interface/icons/"

function mouseOverThumb(thumbnail)
{
    document.getElementById("M" + thumbnail).src = imagePath + thumbnail + "_3.gif";
}

function mouseExitThumb(thumbnail)
{
    document.getElementById("M" + thumbnail).src = imagePath + thumbnail + "_1.gif";
}

function enterProduct(hiking, trekking, mountain, climbing, cycling, alpine_ski, touring, boarding, running, walking, family, kids, travel, city, business)
{
    if (hiking)
    {
        document.getElementById("Mhiking").src = imagePath + "hiking_2.gif";
    }
    if (trekking)
    {
        document.getElementById("Mtrekking").src = imagePath + "trekking_2.gif";
    }
    if (mountain)
    {
        document.getElementById("Mmountain").src = imagePath + "mountain_2.gif";
    }
    if (climbing)
    {
        document.getElementById("Mclimbing").src = imagePath + "climbing_2.gif";
    }
    if (cycling)
    {
        document.getElementById("Mcycling").src = imagePath + "cycling_2.gif";
    }
    if (alpine_ski)
    {
        document.getElementById("Malpine_ski").src = imagePath + "alpine_ski_2.gif";
    }
    if (touring)
    {
        document.getElementById("Mtouring").src = imagePath + "touring_2.gif";
    }
    if (boarding)
    {
        document.getElementById("Mboarding").src = imagePath + "boarding_2.gif";
    }
    if (running)
    {
        document.getElementById("Mrunning").src = imagePath + "running_2.gif";
    }
    if (walking)
    {
        document.getElementById("Mwalking").src = imagePath + "walking_2.gif";
    }
    if (family)
    {
        document.getElementById("Mfamily").src = imagePath + "family_2.gif";
    }
    if (kids)
    {
        document.getElementById("Mkids").src = imagePath + "kids_2.gif";
    }
    if (travel)
    {
        document.getElementById("Mtravel").src = imagePath + "travel_2.gif";
    }
    if (city)
    {
        document.getElementById("Mcity").src = imagePath + "city_2.gif";
    }
    if (business)
    {
        document.getElementById("Mbusiness").src = imagePath + "business_2.gif";
    }
}

function leaveProduct()
{
    document.getElementById("Mhiking").src = imagePath + "hiking_1.gif";
    document.getElementById("Mtrekking").src = imagePath + "trekking_1.gif";
    document.getElementById("Mmountain").src = imagePath + "mountain_1.gif";
    document.getElementById("Mclimbing").src = imagePath + "climbing_1.gif";
    document.getElementById("Mcycling").src = imagePath + "cycling_1.gif";
    document.getElementById("Malpine_ski").src = imagePath + "alpine_ski_1.gif";
    document.getElementById("Mtouring").src = imagePath + "touring_1.gif";
    document.getElementById("Mboarding").src = imagePath + "boarding_1.gif";
    document.getElementById("Mrunning").src = imagePath + "running_1.gif";
    document.getElementById("Mwalking").src = imagePath + "walking_1.gif";
    document.getElementById("Mfamily").src = imagePath + "family_1.gif";
    document.getElementById("Mkids").src = imagePath + "kids_1.gif";
    document.getElementById("Mtravel").src = imagePath + "travel_1.gif";
    document.getElementById("Mcity").src = imagePath + "city_1.gif";
    document.getElementById("Mbusiness").src = imagePath + "business_1.gif";
}


function ShowFlashViewer(viewerUrl,imgSmall,imgMiddle,imgBig) {
    document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"233\" height=\"196\" id=\"viewer\" align=\"middle\">\n');
    document.write('<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n');
    document.write('<param name=\"movie\" value=\"' + viewerUrl + '?z1path=' + imgSmall + '&z2path=' + imgMiddle + '&z4path=' + imgBig + '\" />\n');
    document.write('<param name=\"quality\" value=\"high\" />\n');
    document.write('<param name=\"wmode\" value=\"transparent\" />\n');
    document.write('<param name=\"quality\" value=\"high\" />\n');
    document.write('<param name=\"salign\" value=\"LT\" />\n');
    document.write('<param name=\"bgcolor\" value=\"#ffffff\" />\n');
    document.write('<embed src=\"' + viewerUrl + '?z1path=' + imgSmall + '&z2path=' + imgMiddle + '&z4path=' + imgBig + '\" quality=\"high\" bgcolor=\"#ffffff\" width=\"233\" height=\"196\" name=\"viewer\" align=\"middle\" wmode=\"transparent\" salign=\"LT\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n');
    document.write('</object>\n');
}

function updateProductFlash(img)
        {

            img = "/images/resize/products/" + img;
            
            smallImg = img.replace(".","_s.");           
            medImage = img.replace(".","_m.");           
            largeImage = img.replace(".","_l.");          
            var createFlash = new SWFObject('/flash/viewer.swf?z1path=' + smallImg + '&z2path=' + medImage + '&z4path=' + largeImage,'ProductFlash','300','275','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','#ffffff');  
            createFlash.write('ProductFlash');
        }
        
        
        function BuyNow()
        {
            document.getElementById('BuyNowFrm').submit();
        }
        
        function UpdateCart()
        {
            document.getElementById('CartAction').value="update";
            document.getElementById('CartForm').submit();
        }
        
        function UpdateShipping()
        {
            alert();
            document.getElementById('CartAction').value="updateShipping";
            document.getElementById('CartShippingZone').value=document.getElementById('ShippingZone').value;
            document.getElementById('CartForm').submit();
        }
        
        function EnterDeliveryDetails()
        {
            document.getElementById('CartAction').value="GoCheckout";
            //document.getElementById('CartShippingZone').value=document.getElementById('ShippingZone').value;
            document.getElementById('CartForm').submit();
            
        }
        
        function ConfirmOrderDetails()
        {
            if (checkDeliveryFields())
            {
                document.getElementById('DeliveryDetailsForm').submit()
            }
        }
        
        function checkDeliveryFields() {
			missinginfo = "";
			
			if (document.getElementById("bName").value == "") {
			missinginfo += "\n     -  Billing Name";
			}
			if (document.getElementById("bAddress1").value == "") {
			missinginfo += "\n     -  Billing Address 1";
			}
			if (document.getElementById("bCity").value == "") {
			missinginfo += "\n     -  Billing City";
			}
			if (document.getElementById("bPostcode").value == "") {
			missinginfo += "\n     -  Billing Postcode";
			}
			if (document.getElementById("bEmail").value == "") {
			missinginfo += "\n     -  Billing Email";
			}
			if (document.getElementById("bTel").value == "") {
			missinginfo += "\n     -  Billing Tel";
			}
			if (document.getElementById("dTel").value == "") {
			missinginfo += "\n     -  Daytime Tel";
			}
			
			if (document.getElementById("SeperateAddress").checked)
			{
			    if (document.getElementById("dName").value == "") {
			    missinginfo += "\n     -  Delivery Name";
			    }
			    if (document.getElementById("dAddress1").value == "") {
			    missinginfo += "\n     -  Delivery Address 1";
			    }
			    if (document.getElementById("dCity").value == "") {
			    missinginfo += "\n     -  Delivery City";
			    }
			    if (document.getElementById("dPostcode").value == "") {
			    missinginfo += "\n     -  Delivery Postcode";
			    }
			}

			//alert(document.form_cart.podiatrist.checked);
			if (missinginfo != "") {
			missinginfo ="_____________________________\n" +
			"You failed to correctly fill in your:\n" +
			missinginfo + "\n_____________________________" +
			"\nPlease re-enter and submit again!";
			alert(missinginfo);
			    return false;
		    }
			else return true;
		}
		
		function deliverTo(toggle)
		{
		    if (toggle == 0)
		    {
		        document.getElementById("DeliveryAddressForm").style.display = "none" 
		    }
		    else
		    {
		        document.getElementById("DeliveryAddressForm").style.display = "block" 
		    }
		}
		
		function GoToPaymentGateway()
		{
		    document.getElementById('FormEPDQ').submit()
		}