if(document.layers){
	yg_onResizeNS4.w=innerWidth;yg_onResizeNS4.h=innerHeight;
	if(document.embeds.length>0)setInterval("yg_onResize()",200);
	else onresize=yg_onResizeNS4;
}else if((navigator.userAgent.indexOf("Mac")!=-1)&&(document.all)){
	onresize=yg_onResizeMacIE;
}
function yg_onResizeNS4(){
	if(w!=innerWidth||h!=innerHeight)location.reload();
}
function yg_onResizeMacIE(){
	location.reload();
}
function yg_onResizeNS6(){
	location.reload();
}

function ylib_Browser() {
 d=document;
 this.agt=navigator.userAgent.toLowerCase();
 this.major = parseInt(navigator.appVersion);
 this.dom=(d.getElementById)?1:0; // true for ie6, ns6
 this.ns=(d.layers);
 this.ns4=(this.ns && this.major == 4);
 this.ns4up=(this.ns && this.major >=4);
 this.ns6=(this.dom&&navigator.appName=="Netscape");
 this.op=(window.opera? 1:0);
 this.op6= ((this.agt.indexOf("opera 6") > 0) || (this.agt.indexOf("opera/6") > 0));
 this.ie=(d.all);
 this.ie4=(d.all&&!this.dom)?1:0;
 this.ie4up=(this.ie && this.major >= 4);
 this.ie5=(d.all&&this.dom &&  navigator.userAgent.match(/MSIE 5/));
 this.ie6=(d.nodeType)? 1:0;
 this.sf=(this.agt.indexOf("safari")!=-1);
 this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
 this.mac=(this.agt.indexOf("mac")!=-1);
}
var oBw = new ylib_Browser();

function yg_popup(u,n,w,h,k){
        var a=[],o=null,r=arguments;
        a[0]="width="+w+",height="+h;
        a[1]=",scrollbars="+((k&1)?1:0);
        a[2]=",resizable="+((k&2)?1:0);
        a[3]=",toolbar="+((k&4)?1:0);
        a[4]=",status="+((k&8)?1:0);
        a[5]=",location="+((k&16)?1:0);
        a[6]=",menubar="+((k&32)?1:0);
        if(r.length>=6){a[7]=(document.layers)?",screenX="+r[5]:",left="+r[5]}
        if(r.length>=7){a[8]=(document.layers)?",screenY="+r[6]:",top="+r[6]}
        a=a.join("");o=open(u,n,a);o.focus();
        return o;
}

function setFL(field) {
	var val=field.options[field.selectedIndex].value;
	if(val=="Use Address Below") {
		document.mapForm2.addr.value=""
		document.mapForm2.csz.value=""
		return
	}
	var keyValue=val.split("")
	if(keyValue.length < 2) {
		document.mapForm2.addr.value=""
		document.mapForm2.csz.value=""
	}
	var addrArray=keyValue[1].split("");
	if(addrArray[0]&&addrArray[0] != "") {
		document.mapForm2.addr.value=addrArray[0]
		if ( addrArray[0] != keyValue[0] ) 
			document.mapForm2.name.value=keyValue[0]
		else
			document.mapForm2.name.value="";
	}
else {
document.mapForm2.addr.value=""
}
if(addrArray[1]&&addrArray[1] != "") {
document.mapForm2.csz.value=addrArray[1]
}
else {
document.mapForm2.csz.value=""
}
if(addrArray[2]&&addrArray[2]=="ca") {
document.mapForm2.country.selectedIndex=1
}
else if(addrArray[2]&&addrArray[2]=="fr") {
document.mapForm2.country.selectedIndex=2
}
else if(addrArray[2]&&addrArray[2]=="de") {
document.mapForm2.country.selectedIndex=3
}
else if(addrArray[2]&&addrArray[2]=="it") {
document.mapForm2.country.selectedIndex=4
}
else if(addrArray[2]&&addrArray[2]=="sp") {
document.mapForm2.country.selectedIndex=5
}
else if(addrArray[2]&&addrArray[2]=="uk") {
document.mapForm2.country.selectedIndex=6
}
else if(document.mapForm2.country) {
document.mapForm2.country.selectedIndex=0
}
if ( addrArray[3]&&addrArray[3]!= "" ) {
var llValue=addrArray[3].split("")
  if(llValue.length == 2) {
     document.mapForm2.lat.value=llValue[0]
     document.mapForm2.lon.value=llValue[1]
     document.mapForm2.qty.value="12"
  }
}
}
function setCSZ(field) {
var val=field.options[field.selectedIndex].value;
if(val && val != "") {
document.mapForm2.csz.value=val;
}
else {
document.mapForm2.csz.value=""
}
}

function setCookie(key, value) {

        var today = new Date();
        var expiry = new Date(today.getTime() + 3650 * 24 * 60 * 60 * 1000); // plus 150 days
        var v_tail = "; expires=" + expiry.toGMTString()
        var c_name = "YMAP";

        var v_domain_len = document.domain.length;
        var v_corp_domain = 'corp.yahoo.com';
        // alert(document.domain.substring(v_domain_len - v_corp_domain.length, v_domain_len));
        if (document.domain.substring(v_domain_len - v_corp_domain.length, v_domain_len) == v_corp_domain)
                v_tail += "; domain=corp.yahoo.com";
        else
                v_tail += "; domain=maps.yahoo.com";


        var v_cookies = document.cookie;
        var b = document.cookie.indexOf(c_name+"=");
        var v_cookie_ymap = "";
        if (b != -1)
        {
                b += c_name.length+1;
                var e = document.cookie.indexOf(";", b);
                if (e == -1) e = document.cookie.length;
                v_cookie_ymap = unescape(document.cookie.substring(b, e));
        }

        if (v_cookie_ymap == "")
        {
                document.cookie = ("YMAP=" + key + "=" + value + v_tail);
                return;
        }

        var v_ymap_arr = v_cookie_ymap.split("&");
        var v_sect="";
        for (i = 0; i < v_ymap_arr.length; i++)
        {
                if (v_ymap_arr[i].substr(0, key.length) == key || v_ymap_arr[i] == "" )
                {
			continue;
                } else {
			if ( v_sect != "" ) v_sect += "&";
                        v_sect += v_ymap_arr[i];
                }
        }
	//set new value
	if ( v_sect != "" ) v_sect += "&";
	v_sect += key + "=" + value;

        if (v_sect != "")
        {
                document.cookie = ("YMAP=" + v_sect + v_tail);

        }
}

function c_ad_click(cat, rd) {
    if (mpoi_is_supported()) {
	var node = document.getElementById(cat);
	if (node) { 
	    node.checked = 1; 
	    var form = node.form;
	    form.rezoom.value = 1;
	    form.action = rd + form.action;
	    form.submit();
	    return false;
	}
    }
    return true;
 }


function traff_state(sState,sType) {
	if(sType != 'hide'){
	if(sState == 'dwn')
		d.getElementById('traffbtn').src="http://us.i1.yimg.com/us.yimg.com/i/us/map/gr/view_02.gif";
	else
		d.getElementById('traffbtn').src="http://us.i1.yimg.com/us.yimg.com/i/us/map/gr/view_01.gif";
	} else {
	if(sState == 'dwn')
                d.getElementById('traffbtn').src="http://us.i1.yimg.com/us.yimg.com/i/us/map/gr/hide_02.gif";
        else
                d.getElementById('traffbtn').src="http://us.i1.yimg.com/us.yimg.com/i/us/map/gr/hide_01.gif";
	}
}

function preLoadObjs() {
	if (document.getElementById) {
		o = document.createElement("iframe");
		o.width = 1 + "px";o.height =  1 + "px";o.frameBorder = 0;
		o.src = "preload.php";
		document.body.appendChild(o);
	}
}
