﻿function setText(a, b)
{
    x = document.getElementById(a);
    if (x)
    x.innerHTML = b.options[b.selectedIndex].innerHTML;
}

$(document).ready(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto({
        theme: 'facebook' ,
        overlay_gallery: false
    });

    $(".clickable").click(function() {
        location = $(this).find("a:first").attr("href");
    })

});

function PostSearchBox(uniqueID) {
    var val = $("[id$=_txtSearch]").attr("id");
    if (val.length == 0 || val == 'Zoek uw weegschaal op naam, merk of productnummer' || val == '') {
        return false;
    } else {
        __doPostBack(uniqueID, '');
    }
}

function ShippingEqualsInvoice(val) {
    var inv = $("#bevestiging .invoice");
    var ship = $("#bevestiging input:text");
    for (var i = 0; i < inv.length; i++) {
        var invoiceValue = inv.eq(i);
        var shipValue = ship.eq(i);
        if (val) {
            shipValue.val(invoiceValue.html());
        } else {
            shipValue.val("");
        }
    }
}

function PasswordRecover(uniqueID){ 
    var email = $("[id$=_txtEmailAddress]").attr("id");
    var value = $("#" + id).val();
    
    if (value.length == 0) { 
        return false; 
    } else { 
        __doPostBack(uniqueID, '');
    }
}

function Login(uniqueID){ 
    var email = $("[id$=_txtLogin]").val();
    var password = $("[id$=_txtPassword]").val();
    
    if (valEmail.length == 0 && valPassWord.length == 0) { 
        return false; 
    } else { 
        __doPostBack(uniqueID, '');
    }
}

function LoginSideBar(uniqueID){ 
    var email = $("[id$=_txtEmail]").val();
    var password = $("[id$=_txtPassword]").val();
 
    if (email.length == 0 && password.length == 0) { 
        return false; 
    } else { 
        __doPostBack(uniqueID, '');
    }
}

function AutoFill(selector, text) {
    $(selector).attr({ value: text }).focus(function() { 
		if($(this).val()==text){ $(this).val(""); }}).blur(function(){
		if($(this).val()==""){ $(this).val(text); }
	});
}

function writeFlash(url, w, h) {
    document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"" + w + "\" height=\"" + h + "\" id=\"Drakes\" align=\"middle\">");
    document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />");
    document.write("<param name=\"movie\" value=\"" + url + "\" />");
    document.write("<param name=\"quality\" value=\"high\" />");
    document.write("<param name=\"bgcolor\" value=\"#000000\" />");
    document.write("<param name=\"wmode\" value=\"transparent\" />");
    document.write("<param name=\"loop\" value=\"true\" />");
    document.write("<embed src=\"" + url + "\" quality=\"high\" loop=\"true\" wmode=\"transparent\" bgcolor=\"#000000\" width=\"" + w + "\" height=\"" + h + "\" name=\"Drakes\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" />");
    document.write("</object>");
}
