function update_mainframe(lang,m1,m2,m3)
{
     if(!m3) 
     	parent.main_frame.location.href="main.phtml?lang="+lang+"&m1="+m1+"&m2="+m2;
     else	
     	parent.main_frame.location.href="main.phtml?lang="+lang+"&m1="+m1+"&m2="+m2+"&m3="+m3;
}



if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.submenu_td {display: block; padding:0px 0px; border:1px solid #5E544D; border-collapse:collapse; background-color:#eeeeee; padding:0px 20px; }\n')
document.write('</style>\n')
}

function SwitchMenu(obj){

        if(document.getElementById){
		var el;
               	var ar = document.getElementById("masterdiv").getElementsByTagName("span");

		for( var j=1; j < 15 ; j++ )
		{
			obj_id = obj+'tr_'+j;
			el =  document.getElementById(obj_id)

                	if(!el)
				continue;
                        if(el.style.display != "block"){ 
                                for (var i=0; i<ar.length; i++){
                                        if (ar[i].className=="submenu_td")
					{
                                        	ar[i].style.display = "none";
					}
                                }
                                el.style.display = "block";
                        }else{
                                el.style.display = "none";
                        }
                }
	}
}

function updateframe2(lang,m1,m2,m3)
{
        parent.left_frame.location.href="sidemenu.phtml?lang="+lang+"&m1="+m1+"&m2="+m2+"&m3="+m3;
     	parent.main_frame.location.href="main.phtml?lang="+lang+"&m1="+m1+"&m2="+m2+"&m3="+m3;
}

function goto_logout_page(lang,m1,m2,m3)
{
       parent.main_frame.location.href=lang+"/customer/logout.phtml?lang="+lang+"&m1="+m1+"&m2="+m2+"&m3="+m3;
}

function goto_register_page(lang,m1,m2,m3,id)
{
       parent.main_frame.location.href=lang+"/customer/register.phtml?lang="+lang+"&m1="+m1+"&m2="+m2+"&m3="+m3+"&uid="+id;
}


function goto_login_page(lang,m1,m2,m3)
{
       parent.main_frame.location.href=lang+"/customer/login.phtml?lang="+lang+"&m1="+m1+"&m2="+m2+"&m3="+m3;
}

function ChangePage(lang,m1,m2,m3,value) {
	var p;
	p="main.phtml?lang="+lang+"&m1="+m1+"&m2="+m2+"&m3="+m3+"&product_name="+value;
	window.location.href=p;
};

function TitleMouseOver(index)
{
        document.getElementById(index).style.backgroundColor="#dddddd";
        document.getElementById(index+1).style.backgroundColor="#dddddd";
}

function TitleMouseOut(index)
{
        document.getElementById(index).style.backgroundColor="#000000";
        document.getElementById(index+1).style.backgroundColor="#000000";
}

function SubMenuMouseOver(index)
{
        document.getElementById(index).style.backgroundColor="#aaaaa";
        document.getElementById(index+1).style.backgroundColor="#aaaaaa";
}

function SubMenuMouseOut(index)
{
        document.getElementById(index).style.backgroundColor="#dddddd";
        document.getElementById(index+1).style.backgroundColor="#dddddd";
}


function SubMenuMouseOver_box(index)
{
        document.getElementById(index).style.backgroundColor="#aaaaaa";
        document.getElementById(index+1).style.backgroundColor="#aaaaaa";
}

function SubMenuMouseOut_box(index)
{
        document.getElementById(index).style.backgroundColor="#dddddd";
        document.getElementById(index+1).style.backgroundColor="#dddddd";
}


function subopen( fname, select, s_id)
{
//        window.open("submenu.phtml?select="+select+"&s_id="+s_id,"submenu" );
        window.open(fname, "maincontent");
}


function GotoShopPage(pid)
{
	var p;
	p="shop/dvProduct_new.phtml?pid="+pid;
	window.location.href=p;
}


function SelectAddress(zipcode,address1,address2) 
{
	parent.opener.self.document.write.home_address.value = address1+' '+address2;
	parent.opener.self.document.write.zipcode.value = zipcode;
	self.close();
}

function refresh_parent(url)
{
	this.opener.location.href=url;
	self.close();
}


function getCookie( name )
{
        var nameOfCookie = name + "=";
        var x = 0;
        while ( x <= document.cookie.length )
        {
                var y = (x+nameOfCookie.length);
                if ( document.cookie.substring( x, y ) == nameOfCookie )
                {
                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                                endOfCookie = document.cookie.length;
                        return unescape( document.cookie.substring( y, endOfCookie ) );
                }
                x = document.cookie.indexOf( " ", x ) + 1;
                if ( x == 0 )
                break;
        }
        return "";
}

