var currentClip  = 508;


function moveTo(elm,finalClip){

 currentClip = Math.ceil((currentClip-(currentClip - finalClip)/4));
 //elm.style.width=total+'px';
elm.style.clip="rect(0px 508px 399px "+currentClip+"px)";

 function c() {
     moveTo(elm,finalClip);
 }
 if(currentClip<=0) {
  clearTimeout(timer);
  //alert('done');
  return;
 }
 timer=setTimeout(c,100);
}

function expand(){
hideProds(0);
elm = document.getElementById('contentLarge');
finalClip = -10;
 currentClip = Math.ceil((currentClip-(currentClip - finalClip)/3));

elm.style.clip="rect(0px 508px 399px "+currentClip+"px)";

 function c() {
     expand(elm,finalClip);
 }
 if(currentClip<=0) {
  clearTimeout(timer);
  return;
 }
 timer=setTimeout(c,100);
}

function contract(){
elm = document.getElementById('contentLarge');
finalClip = 508;
 currentClip = Math.ceil((currentClip-(currentClip - finalClip)/1));

elm.style.clip="rect(0px 508px 399px "+currentClip+"px)";

 function c() {
     contract(elm,finalClip);
 }
 if(currentClip>=408) {
  clearTimeout(timer);
  //alert('done');
  return;
 }
 timer=setTimeout(c,100);
}



var timeout	= 200;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';
	document.getElementById('countrySelectBG').style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	document.getElementById('countrySelectBG').style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

function prodPop(ID) {
	hideProds(ID);
	document.getElementById('prodPop' + ID).style.visibility = 'visible';
	document.getElementById('prodPop' + ID + 'Text').style.visibility = 'visible';
	document.getElementById('prodPopBg').style.visibility = 'visible';
	document.getElementById('prodUnderlay').style.visibility = 'visible';
	if (ID>5)	{
		document.getElementById('prodPopBg').style.left = 686;
		document.getElementById('prodPopBg').style.top = 345 + ((ID-6)*35);
		}
	else	{
		document.getElementById('prodPopBg').style.left = 532;
		document.getElementById('prodPopBg').style.top = 345 + ((ID-1)*35);
		}
	
}
		
function hideProds(ID)	{
	for (i=1;i<=10;i++)	{
		if (i != ID)	{
			document.getElementById('prodPop' + i).style.visibility = 'hidden';
			document.getElementById('prodPop' + i + 'Text').style.visibility = 'hidden';
		}
	}
	if (ID == 0)	{
		document.getElementById('prodPopBg').style.visibility = 'hidden';
		document.getElementById('prodUnderlay').style.visibility = 'hidden';
	}
}

function rollOver(ID, state) {
	hideEm(ID);
	document.images['nav' + ID].src = 'images/nav'+ ID  + state + '.gif';
	document.getElementById('navPop' + ID).style.visibility = 'visible';
	document.getElementById('underlay' + ID).style.visibility = 'visible';
	document.getElementById('underlay0').style.visibility = 'visible';
		}
		
function hideEm(ID)	{
	for (i=1;i<=3;i++)	{
		if (i != ID)	{
			document.images['nav' + i].src = 'images/nav'+ i + '.gif';
			document.getElementById('navPop' + i).style.visibility = 'hidden';
			document.getElementById('underlay' + i).style.visibility = 'hidden';
		}
	}
	if (ID == 0)	{
		document.getElementById('underlay0').style.visibility = 'hidden';
	}
}

function showBG()	{
		document.getElementById('countrySelectBG').style.visibility = 'visible';
		document.getElementById('countryUnderlay').style.visibility = 'visible';
		}
		
function hideBG()	{
		document.getElementById('countrySelectBG').style.visibility = 'hidden';
		document.getElementById('countryUnderlay').style.visibility = 'hidden';
		}
		
function stickerPop(action) {
	if (action == 'show')	{
	document.getElementById('stickerPop').style.visibility = 'visible';
	}
if (action == 'hide')	{
	document.getElementById('stickerPop').style.visibility = 'hidden';
	}
}
		
function learnMore(action)	{
if (action == 'show')	{
	document.getElementById('learnMore').style.height = '570px';
	}
if (action == 'hide')	{
	document.getElementById('learnMore').style.height = '1px';
	}
}

// close layer when click-out
document.onclick = mclose; 




