
function flash(path,w,h) {

	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" id="nav" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+path+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<embed src="'+path+'" quality="high"  width="'+w+'" height="'+h+'" name="nav" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('<'+'/object>');
}

function flashnav() {
	w=812;
	h=136;
	path="/swf/nav.swf?vars=/nav.xml";
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" id="nav" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+path+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<embed src="'+path+'" quality="high"  width="'+w+'" height="'+h+'" name="nav" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('<'+'/object>');
}


function jumpTo(id) {
	locale="";
	path=false;
	if(id=="01") path="/howitworks/keyfeatures.html";
	if(id=="00") path="/home.html";
	if(id=="02") path="/chooseyourharmony/overview.html";
	if(id=="03") path="/beattheharmony/prizes.html";
	if(id=="04") window.open('http://www.logitech.com/index.cfm/store_locator/home//');
	if(path) window.location.href='http://www.logitech-harmony.com'+locale+path;
}

function popup(that) {
		w=400;
		h=400;
		ltpopup=window.open(that, 'ltPopup', 'width='+w+',height='+h+',locationbar=no,toolbar=no,scrollbars=yes,left='+(Math.round((screen.width-w)/2))+',top='+(Math.round((screen.height-h)/2)));

		ltpopup.focus();
}



function init() {
	if (!document.getElementsByTagName){ return; }
	var anchors = document.getElementsByTagName('a');
	
	// loop through all anchor tags
	for (var i=0; i<anchors.length; i++){
		var anchor = anchors[i];
		
		var relAttribute = String(anchor.getAttribute('rel'));
		
		// use the string.match() method to catch 'lightbox' references in the rel attribute
		if (anchor.getAttribute('href') && (relAttribute.toLowerCase().match('popup'))){
//			alert(anchor.href);
			anchor.onclick = function () { popup(this.href); return false;}
		}
	}
}

function startWith(country,language){
	country=country.toUpperCase();
	window.location.href="/"+language+"/"+country+"/home.html";
}

function showLayer(id) {
	document.getElementById('circleA').className='';
	document.getElementById('circleB').className='';
	document.getElementById('circleC').className='';
	document.getElementById('layer1').style.display='none';
	document.getElementById('layer2').style.display='none';
	document.getElementById('layer3').style.display='none';

	document.getElementById(id).style.display='block';

	if(id=='layer1') document.getElementById('circleA').className='active';
	if(id=='layer2') document.getElementById('circleB').className='active';
	if(id=='layer3') document.getElementById('circleC').className='active';
}

function showLarge(id) {
	showLargeWin=window.open('','showLarge','width=280,height=650');
	showLargeWin.document.open();
	showLargeWin.document.write('<html><head><title>logitech-harmony.com '+id+'</title></head><body><center><img src="/images/large/'+id+'.jpg" onclick="self.close();" style="cursor:pointer;"/></center></body></html>');
	showLargeWin.document.close();
	showLargeWin.focus();
}


function tellafriend(path) {
	tellpath='http://www.logitech-harmony.com'+path;
	tellafriend=window.open('http://www.logitech.com/utilities/act_tellafriend.cfm?refurl='+escape(tellpath)+'&countryid=&languageid=', 'newWindow','scrollbars=mo,resizable=yes,width=330,height=460');
	tellafriend.focus();
}

function openWindowFromContestFlash(id) {
	if(id=="tellafriend") tellafriend(''); 
	if(id=="termsparticipation") termsparticipation();
	if(id=="termslogitech") termsOfUse();
	if(id=="howitworks") window.location.href='///howitworks/keyfeatures.html';
}


function termsparticipation() {
	window.open('///popup/termsofparticipation.html','terms','width=800,height=440');
}

function privacySecurity(){
		url='http://www.logitech.com/index.cfm?PAGE=utilities/home&CONTENTID=4056&countryid=&languageid=';
		window.open(url,'privacySecurity');
}


function findDealer(){
			url='http://www.logitech.com/index.cfm?PAGE=store_locator/home&countryid=&languageid=';
		window.open(url,'findDealer');
}

function newAccount(){
		url='';
	window.open(url,'newAccount');
}

function memberLogin(){
		url='';
	window.open(url,'memberLogin');
}

function contactUs(){
		url='http://www.logitech.com/index.cfm?PAGE=utilities/contact&countryid=&languageid=';
	window.open(url,'contactUs');
}	
function termsOfUse() {
	url='http://www.logitech.com/index.cfm/utilities/home//,contentid=4064';
	window.open(url,'termsOfUse');
}

function buyNow(id) {
	currentCountry = '';
	baseurl = 'http://shop.logitech.com/basket?shop=consumer&country=&lang=&add';
	if(id=='895') url='&p1=966193-0914&q1=1'
	if(id=='885') url='&p1=966187-0914&q1=1'
	if(id=='785') url='&p1=966193-0914&q1=1'
	if(id=='555') url='&p1=966193-0914&q1=1'
	if(id=='525') url='&p1=966191-0914&q1=1'
	if (currentCountry == 'INT') {
		window.open('http://shop.logitech.com/','buyNow');
	} else {
		window.open(baseurl+url,'buyNow');
	}
}

function moreInfos(id) {
	baseurl='http://www.logitech.com/index.cfm/products/detailsharmony//,CRID=2084,';
	if(id=='895') url='CONTENTID=10930';
	if(id=='885') url='CONTENTID=9933';
	if(id=='785') url='CONTENTID=11735';
	if(id=='555') url='CONTENTID=11700';
	if(id=='525') url='CONTENTID=10929';
	window.open(baseurl+url,'moreInfos');
}
