﻿function HideLabel(oLabel)
{
    document.getElementById(oLabel).style.display = 'none';
}

function ResetLogin()
{
    document.getElementById("ctl00_body_txtExistingEmail").value = "";
    document.getElementById("ctl00_body_txtExistingPassword").value = "";
    document.getElementById("ctl00_body_pnlLoginMessage").style.display = 'none';
    document.getElementById("ctl00_body_txtExistingEmail").focus();
}

function ResetLogin2()
{
    document.getElementById("ctl00_body_txtNewFirstName").value = "";
    document.getElementById("ctl00_body_txtNewSurname").value = "";
    document.getElementById("ctl00_body_txtNewEmail").value = "";
    document.getElementById("ctl00_body_txtNewPassword").value = "";
    document.getElementById("ctl00_body_txtNewConfirmPassword").value = "";
    document.getElementById("ctl00_body_pnlLoginMessage2").style.display = 'none';
    document.getElementById("ctl00_body_txtNewFirstName").focus();
}

function WatchItem()
{
    alert("Boo!");
    return false;
}

function fav()
{
	if (document.all)
		window.external.AddFavorite('http://www.find-electricalgoods.co.uk/', 'Find Cheap Electrical Goods');
	else
		alert("Sorry. Netscape users must bookmark the pages manually by hitting <Ctrl-D>");
}



function eMail() {
	window.location = "mailto:info@find-electricalgoods.co.uk"
}

function ValidatePrice(oPrice)
{
    
    oPriceVal = document.getElementById(oPrice).value;
    
     if (isNaN(oPriceVal) || oPriceVal == "") 
     {
        alert('Must be numerical');
        return false;
     }
     else 
     {
        if (oPriceVal.indexOf('.') == -1) 
        {
            return true;
        }
        else 
        {
            dectext = oPriceVal.substring(oPriceVal.indexOf('.')+1, oPriceVal.length);
            if (dectext.length > 2)  
            {
                alert('No more than 2 digits after the decimal point');
                return false;
            }
            else
            {
                return true;
            }
        }
    }
}

function ValidatePrice2(oPrice)
{
    
    oPriceVal = document.getElementById(oPrice).value;
    
     if (isNaN(oPriceVal) || oPriceVal == "") 
     {
        alert('Must be numerical');
        return false;
     }
     else 
     {
        if (oPriceVal.indexOf('.') == -1) 
        {
            collapse1.slideup();
            return true;
        }
        else 
        {
            dectext = oPriceVal.substring(oPriceVal.indexOf('.')+1, oPriceVal.length);
            if (dectext.length > 2)  
            {
                alert('No more than 2 digits after the decimal point');
                return false;
            }
            else
            {
                collapse1.slideup();
                return true;
            }
        }
    }
}

function ConfirmDelete()
{
    var blnConf = confirm("Are you sure you wish to delete this item from your watch list?");
    
    return blnConf;
}


function doClick(buttonName,e)
    {
//the purpose of this function is to allow the enter key to 
//point to the correct button to click.
        var key;

         if(window.event)
              key = window.event.keyCode;     //IE
         else
              key = e.which;     //firefox
    
        if (key == 13)
        {
            //Get the button the user wants to have clicked
            var btn = document.getElementById(buttonName);
            if (btn != null)
            { //If we find the button click it
                btn.click();
                event.keyCode = 0
            }
        }
   }
