var zoomfactor=1 ;
var divvuakich;
var flag= 0; 
var id_Product1="";  
var maumanche=0;  
 
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("Div3").style.display="none";
		flag=0;
		document.getElementById("headder").style.display="block";
	}
	else
	{
	    if(height<2)
	    {
	        if(Width>80)
	        {
	            Width=Width*1.0 + 80*zoomfactor*(-1);
	            whatcache.style.width=Width+"px";
	        }
		    else
		    {
		        Width= 1 ;
	            whatcache.style.width=Width+"px";
		    }
		    
	    }
	    else
	    {
		    height=height*1.0 + 50*zoomfactor*(-1);
		    whatcache.style.height=height+"px";
		}
	}
}
function Zoom(originalW, originalH, what, state)
{ 
    whatcache=document.getElementById("Div1");
//	prefix= -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)
    {  alert('')
        if(flag==0)
        {
            id_Product1=id_Product;
            document.getElementById("manche").style.backgroundColor="#000000";
            document.getElementById("manche").style.filter="alpha(opacity=30)";
            document.getElementById("manche").style.opacity="0.5";
            document.getElementById("Div1").style.zIndex="100";
            document.getElementById("Div1").style.display="block";
            document.getElementById("manche1").style.backgroundColor="#000000";
            document.getElementById("Div3").style.display="block";
            flag=1;
            get_url06('Div1,,ProductDetail.aspx?4Language='+Language+'&id_Product='+id_Product,1);
//            get_url06('Div1,,Thongtintieude.aspx?Trang=Trang2',1);
            setTimeout("Zoom1('','','','in')",500);
            maumanche=1;
        }
    }
    function mancheform2(vitri,ngonngu)
    { 
        setTimeout("mancheform3('"+vitri+"','"+ngonngu+"')",10);
        document.getElementById("headder").style.display="none";
     
    }
    function mancheform3(vitri,ngonngu)
    {  
        if(flag==0)
        {
            document.getElementById("manche").style.backgroundColor="#000000";
            document.getElementById("manche").style.filter="alpha(opacity=30)";
            document.getElementById("manche").style.opacity="0.3";
            document.getElementById("Div2").style.zIndex="100";
            if(navigator.appName.indexOf("Microsoft")!=0)
            {
                document.getElementById("Div2").style.marginTop="-270px";
                document.getElementById("Div2").style.marginRight="500px";
            }
            document.getElementById("Div2").style.display="block";
            document.getElementById("manche1").style.backgroundColor="#000000";
            document.getElementById("Div3").style.display="block";
            if(vitri=="1")
            {
                get_url05('Div2,,TyGiaVCB.aspx?4Language=' + ngonngu,1);
            }
            else if(vitri=="2")
            {
                get_url05('Div2,,GiaVang.aspx?4Language=' + ngonngu,1);
            }
            else
            {
                get_url05('Div2,,ChungKhoan.aspx?4Language=' + ngonngu,1);
            }
            document.getElementById("headder").style.display="none";
            maumanche=1;
        
        }
    }
    function closemancheform()
    {
        if(maumanche==1 && flag==0)
        {
            get_url06('Div1,,trangrong.aspx?a=a',1);  
            Zoom("","","","out"); 
            flag=1;
            maumanche=0;
            document.getElementById("Div1").style.display="none";
        }
    }
    function closemancheform2()
    {
        if(maumanche==1)
        {
            get_url01('Div2,,trangrong.aspx?a=a',1); 
            document.getElementById("Div3").style.display="none";
		    document.getElementById("headder").style.display="block"; 
		    document.getElementById("manche").style.backgroundColor="#ffffff";
            document.getElementById("manche").style.filter="alpha(opacity=100)";
            document.getElementById("manche").style.opacity="1";
            document.getElementById("Div2").style.zIndex="-100";
            document.getElementById("manche1").style.backgroundColor="";
            maumanche=0;
        }
    }
    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("manche").style.opacity="1";
            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();}

