


function SelectLanguageDS(iso,id) {
	location.href = "/?sc_itemid=" + id + "&#38;sc_lang=" + iso;
}


function SelectLanguage(ctl, id) {
	var loc = location.href;
	var sLang = ctl.value;
	if (sLang.indexOf('http')>-1) {
		location.href = sLang;
	} else {
		location.href = "/?sc_itemid="+id+"&sc_lang="+sLang;
	}
}

function setFormAction() {
		document.forms[0].onsubmit = storeSearch;
}

function doKeyStoreSearch(evt, target) 
{	
	if (evt.keyCode==13) 
	{
		location.href = encodeURI((target ? target : "") + "?searchtext=" + document.forms[0].txtSearch.value);
		evt.returnValue = null;
		evt.cancelBubble = true;
	}
	return false;
}

function storeSearch(target) {
	location.href = encodeURI((target ? target : "") + "?searchtext=" + document.forms[0].txtSearch.value);
	return false;
}

function openMenu(lng)
{
	remote = window.open("/flash/" + lng + "/flash.htm","myName","width=658,height=505,location=no,toolbar=no,directories=no,status=no,scrollbars=no,resize=no,menubar=no");
	remote.moveTo(((screen.availWidth-640)/2),((screen.availHeight-480)/2));
}

// Fiona flash app
function doFlashApp(itemid,flashfile,altdivid,flashwidth,flashheight,flashvars) {
	var output = "";
	if (flashinstalled==2 && flashversion>=5) {
		output = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+flashwidth+"' height='"+flashheight+"'>"
		output += "<param name='movie' value='"+flashfile+"'/>"
		output += "<param name='quality' value='high'/>"
		output += "<param name='menu' value='0'/>"
		output += "<param name='FlashVars' value='xml=/flashxml/flashapp.aspx?id="+itemid+"&"+flashvars+"&rootPath=http://"+location.hostname+"' />"
		output += "<embed src='"+flashfile+"' FlashVars='xml=/flashxml/flashapp.aspx?id="+itemid+"&"+flashvars+"&rootPath=http://"+location.hostname+"' NAME=flashapp width='"+flashwidth+"' height='"+flashheight+"' autostart='false' quality='high' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></embed>"
		output += "</object>"
		document.write(output);
	} else {
		if (document.getElementById(altdivid)!=null) {
			document.getElementById(altdivid).style.display = "";
		}
	}
}


// show flash
function doFlash(itemid,flashfile,flashwidth,flashheight) {
	var output = "";
	if (flashinstalled==2 && flashversion>=5) {
		output = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+flashwidth+"' height='"+flashheight+"'>"
		output += "<param name='movie' value='"+flashfile+"?id="+itemid+"'/>"
		output += "<param name='quality' value='high'/>"
		output += "<param name='menu' value='0'/>"
		output += "<embed src='"+flashfile+"?id="+itemid+"' NAME=flash22 width='"+flashwidth+"' height='"+flashheight+"' autostart='false' quality='high' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></embed>"
		output += "</object>"
	}
	document.write(output);
}



// show flash (with alternate image
function doFlashAlt(itemid,flashfile,altdivid,flashwidth,flashheight) {
	var output = "";
	if (flashinstalled==2 && flashversion>=5) {  
		output = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+flashwidth+"' height='"+flashheight+"'>"
		output += "<param name='movie' value='"+flashfile+"?id="+itemid+"'/>"
		output += "<param name='quality' value='high'/>"
		output += "<param name='menu' value='0'/>"
		output += "<embed src='"+flashfile+"?id="+itemid+"' NAME=flash22 width='"+flashwidth+"' height='"+flashheight+"' autostart='false' quality='high' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></embed>"
		output += "</object>"
	} else {
		if (document.getElementById(altdivid)!=null) {
			document.getElementById(altdivid).style.display = "";
		}
	}
	document.write(output);
}


function WallpaperSearch(form) {
	if (form.designno.value != "") {
		QS = "?colorid=&styleid=&paperid=&colid=&desno=" + form.designno.value + "&search=";
	}
	else {
		QS = "?colorid=" + form.color.options[form.color.selectedIndex].value;
		QS += "&styleid=" + form.style.options[form.style.selectedIndex].value;
		QS += "&paperid=" + form.papertype.options[form.papertype.selectedIndex].value;
		QS += "&colid=" + form.collection.options[form.collection.selectedIndex].value;
		QS += "&desno=" + form.designno.value;
		QS += "&search=" + form.searchword.value;
	}
	location.href = location.pathname + QS;
}

function OpenWindow(url, w, h, attr)
{
	var m_attr = "toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1";
	var x,y;

	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}

	if (attr)
	{
		m_attr = attr;
	}	
	window.open(url, "", m_attr+",width="+w+",height="+h+",left="+Math.round((x-w)/2)+",top="+Math.round((y-h)/2));
}

function PrintPage() {
	var loc = location.href;
	if (loc.indexOf("#")>0) {
		loc = loc.substring(0, loc.indexOf("#"));
	}
	var pri = "?print=1";
	if (loc.indexOf("?")>0) {
		pri = "&print=1";
	}
	OpenWindow(loc+pri, 760, 500);
}

function PrintSitecorePage() {
	var loc = location.href;
	if (loc.indexOf("#")>0) {
		loc = loc.substring(0, loc.indexOf("#"));
	}
	var pri = "";
	if(loc.indexOf("p=1")<=0){
	    var pri = "?p=1";
	    if (loc.indexOf("?")>0) {
		    pri = "&p=1";
	    }
	}	
	OpenWindow(loc+pri, 760, 500);
}

function SendPage(id) {
	var loc = "/site tools/send page.aspx?pageid="+id;
	var left = screen.width/2 - 160;
	var top = screen.height/2 - 125;
	OpenWindow(loc, 350, 300, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1");
}

function CheckForm(form)
{
	if (form.from.value == "" || form.to.value == "")
	{
		if (form.from.value == "")
		{
			document.getElementById('error1').style.display = "inline";
		}
		if (form.to.value == "")
		{
			document.getElementById('error2').style.display = "inline";
		}
		return false;
	}
	else
	{
		return true;
	}
}

