﻿//$(document).ready(function () {
//    if (!Page_ClientValidate()) {
//        alert("page is not valid");
//    } else {
//        alter("page is valid");
//    }
//});

function checkForm() {
    Page_ClientValidate();
    if (!Page_IsValid) {
        alert('Some of the information you entered is incorrect please look over the form an amend where necessary');
    }
}

function RemoveText(id) {
    var txtBox = document.getElementById(id);
    if (txtBox.value == "Search...") {
        document.getElementById(id).value = ""
    }
}

function AddText(id) {
    if (document.getElementById(id).value == "") {
        document.getElementById(id).value = "Search..."
    }
}

function SwapImage(id) {
    var iconLink = document.getElementById("mainIconLink");
    var div = document.getElementById("image-video-content");

    div.innerHTML = '<a href="#picture" id="mainImageLink" ><img src="/images/productimages/' + id + '_380_252_width_limit.jpg" id="mainImage" /></a>';
    iconLink.style.visibility = "visible";
    iconLink.href = "#picture";

}

function checkPrice(sender, args) {
    args.IsValid = new RegExp("^([0-9])+(\.[0-9]{2})?$").test(String(args.Value));
}

function swapVideo(id) {
    var div = document.getElementById("image-video-content");
    div.innerHTML = '<iframe width="380" height="285" src="http://www.youtube.com/embed/' + id + '" frameborder="0" allowfullscreen></iframe>';
    iconLink.style.visibility = "hidden";
}



