<!--
//if (top.location != location) {
// top.location.href = document.location.href ;
//}
function pickRandom(range) {
    if (Math.random)
        return Math.round(Math.random() * (range-1));
    else {
        var now = new Date();
        return (now.getTime() / 1000) % range;
    }
}
function loadRandImg(){
	var imgs = new Array("home_1.jpg", "home_3.jpg", "home_4.jpg", "home_5.jpg", "home_6.jpg");  //"home_2.jpg", 
    var ic = imgs.length; // Number of alternative images
    var choice = pickRandom(ic);
    newImage = "url(/images_static/" + imgs[choice] + ")";
    if (document.getElementById) {
        document.getElementById('dynbgimg').style.backgroundImage = newImage;
    } else if (document.all) {
        document.all('dynbgimg').style.backgroundImage = newImage;
    } else if (document.layers) {
        document.layers('dynbgimg').style.backgroundImage = newImage;
    }
}
function goPage(which) {
	window.location.href = which;
}
function getRadSet(group) {
    for ( var i=0; i<group.length; i++ ) {
        if ( group[i].checked == true ) {
            return( group[i].value );
        }
    }
    return("");
}
function getCb(CBgroup) {
    var retThis = "";
    for (var j = 0; j < CBgroup.length; j++) {
        if (CBgroup[j].checked){
            retThis += CBgroup[j].value + "; ";
        }
    }
    return retThis;
}

function validate_email(field,alerttxt) {
	with (field) {
		if (value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
			return true
		} else {
			alert(alerttxt);
			return false;
		}
	}
}
function validate_required(field,alerttxt) {
	with (field) {
		if (value==null||value=="") {
			alert(alerttxt);
			return false;
		} else {
			return true
		}
	}
}

function validate_dcLogin(mainform) {
	with (mainform) {
		if (validate_email(login,"Please provide a valid e-mail address!")==false)
		{document.getElementById('login').style.border='1px solid red';login.focus();return false;}
		if (validate_required(passwd,"Please provide a Password")==false)
		{document.getElementById('passwd').style.border='1px solid red';passwd.focus();return false;}
	}
}

function validate_dcSignup(mainform) {
	with (mainform) {
		if (validate_required(uName,"Please fill in your name")==false)
		{uName.focus();return false;}
		if (validate_email(uEmail,"Please provide a valid e-mail address!")==false)
		{uEmail.focus();return false;}
		if (validate_required(uProv.options[uProv.selectedIndex],"Please select a Province!")==false)
		{uProv.focus();return false;}
		if (validate_required(uPostal,"Please fill in Postal Code")==false)
		{uPostal.focus();return false;}
		if (validate_required(uPwd,"Please create a Password (max. 10 characters)")==false)
		{uPwd.focus();return false;}
		if (validate_required(uPwd_2,"Please re-type Password")==false) {
			uPwd_2.focus();
			return false;
		} else {
			if (uPwd_2.value != uPwd.value) {
				alert("Your passwords don\'t match. Please try again!");
				uPwd_2.focus();
				return false;
			}
		}
	}
}
function validate_FranchiseInfo(mainform) {
	with (mainform) {
		if (validate_required(subName,"Please fill in your name")==false)
		{subName.focus();return false;}
		if (validate_email(subEmail,"Please provide a valid e-mail address!")==false)
		{subEmail.focus();return false;}
	}
}
function clear_searchbox_DC() {
	var searchform = document.forms['searchform'];
	if (searchform.search_decortips.value=="By room type, style or keyword")
	{
		searchform.search_decortips.value="";
	}
}
function clear_optinbox() {
	var enewsform = document.forms['enewsform'];
	if (enewsform.optin_email.value=="Enter your email address") {
		enewsform.optin_email.value="";
	}
}
function clear_LLoptinbox() {
	var enewsform = document.forms['enewsformLL'];  //SIGN UP FOR LIVING LIGHTING EMAIL UPDATES
	if (enewsform.optin_email.value=="ENTER YOUR E-MAIL TO RECEIVE LIVING LIGHTING UPDATES")
	{
		enewsform.optin_email.value="";
	}
}
function clear_sitesearchbox() {
	var myform = document.forms['sitesearchform'];
	if (myform.searchtxt.value=="SEARCH SITE") {
		myform.searchtxt.value="";
	}
}
function submit_addWishlist() {
	var myform = document.forms['wishlistform'];
	myform.submit();
}
//-->
