﻿var POSITION=0;
function overMenu(id){
		document.getElementById('menuitemleft_'+id).className = 'menuitemleftover';
		document.getElementById('menuitemcenter_'+id).className =  'menuitemcenterover';
		document.getElementById('menuitemright_'+id).className =  'menuitemrightover';
}
function outMenu(id){
		document.getElementById('menuitemleft_'+id).className = 'menuitemleft';
		document.getElementById('menuitemcenter_'+id).className =  'menuitemcenter';
		document.getElementById('menuitemright_'+id).className =  'menuitemright';		
}
function showImage(id,url){
         $('#'+id).css({'backgroundImage' : 'url("'+url+'")'});
}
function set_Image(id,url){
//	    alert(url);
        var img = new Image();
        $(img).load(function(){
                $('#'+id).stop().animate({ opacity: 0 }, 150);
//				 alert(url);
                setTimeout("showImage('"+id+"','" + url +"')",150);
        $('#'+id).animate({ opacity: 1 } , 150);
        }).attr('src', url);
}
function gotoPostion(id,value,i,pages){
	clearInterval(IntervalId);
	IntervalId = setInterval("nextNews(1024)",6500);
	POSITION = i-1;
	$("#"+id).animate({ marginLeft: value}, 1500);	
	for (var j=1;j <= pages; j++){
		if (j==i){
			document.getElementById('paginationitem_'+j).className = 'paginationitemon';
			document.getElementById('paginationa_'+j).className = 'paginationaon';
		}else{
			document.getElementById('paginationitem_'+j).className = 'paginationitem';
			document.getElementById('paginationa_'+j).className = 'paginationa';
		}
	}
}
function nextNews(WIDTH){
	POSITION++;
	if (POSITION >= POSITIONLIMIT){
		POSITION = 0;	
	}
		gotoPostion('inscreen',-WIDTH*POSITION,POSITION+1,POSITIONLIMIT);
	
}
function showTown(id){
		document.getElementById('townname_'+id).style.display = 'block';
}
function hideTown(id){
		document.getElementById('townname_'+id).style.display = 'none';
}
function setTown(id){
		document.getElementById('towncontentname').innerHTML = document.getElementById('townname_'+id).innerHTML;
		document.getElementById('towncontentcontent').innerHTML = document.getElementById('towncontent_'+id).innerHTML;
}
function showSubMenu(id){
	document.getElementById('submenumain_'+id).style.display = 'block';
}
function hideSubMenu(id){
	document.getElementById('submenumain_'+id).style.display = 'none';
}
function changeLeftMenu(id,cname){
		document.getElementById(id).className = cname;
}

function changeImage(i,id,src,srczoom){
	try{
		document.getElementById('productthumb_1').className='productthumb';
		document.getElementById('productthumb_2').className='productthumb';
		document.getElementById('productthumb_3').className='productthumb';
	}catch(e){
		//
	}
	document.getElementById('productthumb_'+i).className='productthumbon';	
	document.getElementById(id).src = src;
	document.getElementById(id+'link').setAttribute('href',srczoom);
	 $('.cloud-zoom, .cloud-zoom-gallery').CloudZoom();
}


