<!--
var url = 'http://weather.china.com.cn/city/';

function setCookie(name, value, expires, path, domain, secure) {

  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
	//parent.frames[0].document.location.reload();
	//alert(url+document.custom.city.value);
	//url = url + document.custom.city.value + '.html';
//	parent.frames[0].document.location.replace(url);
}

function delCookie(name)//É¾³ýcookie
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.lastIndexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function replace(string,text,by) {
// Replaces text with by in string
    var i = string.indexOf(text);
    var newstr = '';
    if ((!i) || (i == -1)) return string;
    newstr += string.substring(0,i) + by;

    if (i+text.length < string.length)
        newstr += replace(string.substring(i+text.length,string.length),text,by);
    return newstr;
}
 

function getValue(string,elementName,object,elementType) {
    var startPos = string.indexOf(elementName + "=")
    if (startPos > -1) {
        startPos = startPos + elementName.length + 1;
        var endPos = string.indexOf("&",startPos);
        if (endPos == -1) endPos = string.length;

        var elementValue = unescape(string.substring(startPos,endPos));
        
		if (elementType == "hidden")   object.value = elementValue;
    }
}

function getValue_forshow(string,elementName,object,elementType) {
    var startPos = string.indexOf(elementName + "=")
    if (startPos > -1) {
        startPos = startPos + elementName.length + 1;
        var endPos = string.indexOf("&",startPos);
        if (endPos == -1) endPos = string.length;
		if(parseInt(unescape(string.substring(startPos,endPos))) >0)   return true;
		else return false;
    }
}

function getValues(string) {
    getValue(string,"city",document.custom.city,"hidden");
}

function setupForm() {
    if (userProfile) {
		//if(userProfile.indexOf("city=")<0) delCookie("customize_city");
		getValues(userProfile);
		//alert(userProfile)
		}
	url = url + document.custom.city.value + '.html';
	//alert(parent.frames[0].name);
	//parent.frames[0].document.location=url;
//	if(document.all) parent.frames['city_frame_weather'].document.location=url;
//	else if(document.getElementById) 
	//window.top.document.getElementById("city_frame_weather").src = url;
	//parent.frames[0].document.location=url;
	//alert(parent.document.getElementById("city_frame_weather").src)
parent.document.getElementById("city_frame_weather").src = url;
}

function setupFormAll() {
    if (userProfile) getValues(userProfile);
	url = url + document.custom.city.value + '.html';
	//alert(parent.frames[0].name);
	//parent.frames[0].document.location=url;
//	if(document.all) parent.frames['city_frame_weather'].document.location=url;
//	else if(document.getElementById) 
	//window.top.document.getElementById("city_frame_weather").src = url;
	//parent.frames[0].document.location=url;
}

function redirect() {
	if (userProfile){
		getValues(userProfile)
		//url = url + document.custom.city.value + '.html';
		//if(self.location.pathname.search(document.custom.city.value)<0){ window.location = url;}
	}
}
// -->
