function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//MAIN MENU SCRIPT
function jsMenuOnMouseOver(obj)
{
	var s='Image/TopMenu/' + obj.id + '_f2.jpg';
	obj.src=s;
}
function jsMenuOnMouseOut(obj)
{
	var s='Image/TopMenu/' + obj.id + '.jpg';
	obj.src=s;
}
function jsMenuOnMouseDown(obj)
{	
	var s='Image/TopMenu/' + obj.id + '_f2.jpg';
	obj.src=s;
}
function jsMenuOnClick(url)
{	
	window.location=url;
}


//TAB PAGE SCRIPT
function jsTabOnMouseOver(obj)
{
	var s='Image/TabPage/' + obj.id + '_f2.jpg';
	obj.src=s;
}
function jsTabOnMouseOut(obj)
{
	var s='Image/TabPage/' + obj.id;
	var sel=obj.getAttribute('TabSelect');
	if (sel>0) s=s+'_f3';
	s=s+'.jpg';
	obj.src=s;
}
function jsTabOnMouseDown(obj)
{	
	jsTabUnSelect();
	var s='Image/TabPage/' + obj.id + '_f3.jpg';
	obj.setAttribute('TabSelect',1);
	obj.src=s;
	var tabName=obj.getAttribute('TabName');
	eval("jsTabIndexChanged('" + tabName + "')");
}
function jsTabUnSelect()
{
	document.getElementById('downmenu_r1_c1').src='Image/TabPage/downmenu_r1_c1.jpg';
	document.getElementById('downmenu_r1_c2').src='Image/TabPage/downmenu_r1_c2.jpg';
	document.getElementById('downmenu_r1_c3').src='Image/TabPage/downmenu_r1_c3.jpg';
	document.getElementById('downmenu_r1_c4').src='Image/TabPage/downmenu_r1_c4.jpg';
	document.getElementById('downmenu_r1_c5').src='Image/TabPage/downmenu_r1_c5.jpg';
	document.getElementById('downmenu_r1_c1').setAttribute('TabSelect',0);
	document.getElementById('downmenu_r1_c2').setAttribute('TabSelect',0);
	document.getElementById('downmenu_r1_c3').setAttribute('TabSelect',0);
	document.getElementById('downmenu_r1_c4').setAttribute('TabSelect',0);
	document.getElementById('downmenu_r1_c5').setAttribute('TabSelect',0);
}
function jsTabIndexChanged(tabName)
{
	document.getElementById("TabOverview").style.display='none'; 
	document.getElementById("TabFeatures").style.display='none'; 
	document.getElementById("TabAccessory").style.display='none'; 
	document.getElementById("TabSupport").style.display='none'; 
	document.getElementById("TabGallery").style.display='none';
	document.getElementById(tabName).style.display='block'; 
}


//IMAGE GALLERY SCRIPT
var ourInterval;
var scrollSpeed=50;
var scrollHeight=10;
function jsScrollStart(direction)
{
	ourInterval=setInterval("jsScroll"+direction+"();", scrollSpeed);
}
function jsScrollEnd()
{
	clearInterval(ourInterval);
}
function jsScrollUp()
{
	var divName='DivGallery';
	document.getElementById(divName).scrollTop=document.getElementById(divName).scrollTop-scrollHeight;
}
function jsScrollDown()
{
	var divName='DivGallery';
	document.getElementById(divName).scrollTop=document.getElementById(divName).scrollTop+scrollHeight;
}
function jsLoadMediumImage(imgSrc)
{
	imgSrc=imgSrc.replace("thumb_", "");
	document.getElementById("imgMedium").src = imgSrc;
}
function jsShowLargeImage(imgSrc)
{
	imgSrc=imgSrc.replace("thumb_", "");
	jsOpenGallery(imgSrc)
}


//OTHER SCRIPTS
function jsSetCountry(obj)
{
	var selectedCode=obj.value;
	var currentCode=document.getElementById("ccHidden").value;
	if (currentCode==selectedCode) return;
	if (selectedCode=='') obj.options[0].selected=true;
	else if (selectedCode=='NA') alert('Coming Soon...');			
	else if (selectedCode=='DE') window.location.href="http://www.generalmobile.de";	
	else if (currentCode=='US' && selectedCode!='US') window.location.href=selectedCode + "/Default.aspx";
	else if (currentCode!='US' && selectedCode!='US') window.location.href="../" + selectedCode + "/Default.aspx";
	else if (currentCode!='US' && selectedCode=='US') window.location.href="../Default.aspx";
}
function jsOpenGallery(imageName)
{
	var winUrl="Gallery.aspx?ImageName=" + imageName;
	window.open(winUrl,'Gallery','menubar=no,location=no,resizable=yes,scrollbars=no,status=no,width=' + screen.width-50 + ',height=' + screen.height-50 + ',left=25,top=25');
}
function jsListAccessories() 
{ 
	var productId=document.getElementById("ddlProductDefiniton").value;
	var categoryId=document.getElementById("ddlAccessoryCategory").value;
	var contentId=document.getElementById("ciHidden").value;
	window.location.href="Default.aspx?PageName=Support&Action=Accessory&ContentId=" + contentId + "&ProductId=" + productId + "&CategoryId=" + categoryId;
}
