var zoomfactor=1 ;
var divvuakich;
var flag= 0; 
var id_Product1="";  
    
function zoomhelper()
{
	var height=whatcache.style.height.replace("px","");
	var Width=whatcache.style.width.replace("px","");
	if(height<2 && Width<2)
	{ 
		clearzoom(); 
		closemancheform1();
		document.getElementById("cpp").style.display="none";
		flag=0;
		document.getElementById("headder").style.display="block";
	}
	else
	{
	    if(height<2)
	    {
	        Width=Width*1.0 + 80*zoomfactor*prefix;
		    whatcache.style.width=Width+"px";
	    }
	    else
	    {
		    height=height*1.0 + 50*zoomfactor*prefix;
		    whatcache.style.height=height+"px";
		}
	}
}
function Zoom(originalW, originalH, what, state)
{ 
    whatcache=document.getElementById("Div1");
	prefix=(state=="in")? 1 : -1;
	zoomhelper();
	beginzoom=setInterval("zoomhelper()",1)	
}
function clearzoom()
{
	if (window.beginzoom)
		clearInterval(beginzoom)
}


function zoomhelper1()
{
	var height1=whatcache1.style.height.replace("px","");
	var Width1=whatcache1.style.width.replace("px","");
	if(Width1>800 && height1>489)
	{   
		clearzoom1();
		flag=0;
		document.getElementById("tblChitiet").style.display="block";
		
		
	}
	else
	{
	    if(height1>489)
	    {
		    Width1 = Width1*1.0 + 40*zoomfactor*prefix1;
		    whatcache1.style.width=Width1+"px";
		}
		else
		{
		    height1 = height1*1.0 + 50*zoomfactor*prefix1;
		    whatcache1.style.height=height1+"px";
		    
		}
	}
}
function Zoom1(originalW, originalH, what, state)
{ 
	whatcache1=document.getElementById("Div1");
	prefix1=(state=="in")? 1 : -1;
	zoomhelper1();
	beginzoom1=setInterval("zoomhelper1()",1)
}
function clearzoom1()
{
	if (window.beginzoom1)
		clearInterval(beginzoom1)
}
function chay(id)
{ 
	if(flag==0)
	{
		Zoom(31,2,id,'in');
	}
}

//*************************************************************************
    function mancheform1(div,id_Product,Language)
    {  
        if(flag==0)
        {
            id_Product1=id_Product;
            document.getElementById("manche").style.backgroundColor="#000000";
            document.getElementById("manche").style.filter="alpha(opacity=30)";
            document.getElementById("Div1").style.zIndex="100";
            document.getElementById("Div1").style.display="block";
            document.getElementById("manche1").style.backgroundColor="#000000";
            document.getElementById("cpp").style.display="block";
            flag=1;
            get_url00('Div1,,ProductDetail.aspx?4Language='+Language+'&id_Product='+id_Product1,1);
            Zoom1("","","","in")
        }
    }
    function closemancheform()
    {
        if(document.getElementById("manche").style.backgroundColor!="#ffffff" && flag==0)
        {
            Zoom("","","","out"); 
            get_url01('Div1,,trangrong.aspx?a=a',1);  
            flag=1;
        }
    }
    function closemancheform1()
    {
        if(document.getElementById("manche").style.backgroundColor!="#ffffff")
        {
            document.getElementById("manche").style.backgroundColor="#ffffff";
            document.getElementById("manche").style.filter="alpha(opacity=100)";
            document.getElementById("Div1").style.zIndex="-100";
            document.getElementById("manche1").style.backgroundColor="";
            
        }
    }
//***************************************************************************************************
function setPosition(id, position) {var store = {ram : {top :0,left :null},rom : {top : null,left : null}};
for (var i in position) {store.rom[i] = position[i];}var element = document.getElementById(id);for (i in store) {element[i] = store[i];}element.rom.move = function() {if (window.innerHeight) {var topPage = window.pageYOffset;}else {var topPage = document.body.scrollTop;var leftPage = document.body.scrollLeft;}element.style.position = "absolute";
if (element.rom.top != null) {element.ram.top += Math.round((topPage + element.rom.top - element.ram.top)/1);element.style.top = element.ram.top;}
if (element.rom.left != null) {element.ram.left += Math.round((leftPage + element.rom.left - element.ram.left)/1);element.style.left = element.ram.left;}
setTimeout("document.getElementById('"+element.id+"').rom.move()",1);};element.rom.move();}

