document.writeln('<!-- $Id: header.js,v 1.7 2005/02/26 07:01:18 avenger Exp $ -->');
document.writeln('<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">');
document.writeln('<tr>');
document.writeln('<td width="252"><a href="http://www.souwang.com/"><img src="http://www.souwang.com/images/logo.png" width="283" height="46" hspace="5" border=0></a>');
document.writeln('</td>');
document.writeln('<td width="508" align="right">');
document.writeln('<a href="http://www.souwang.com/help/t1.html" target="_blank"><a href="#" onclick="javascript:window.external.AddFavorite(\'http://www.souwang.com\', \'搜网 - souwang.com\')" target="_self"><font color="#000080">加入收藏</font></a> | <a href="#" onclick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://www.souwang.com/\');return(false);"><font color="#000080">设为首页</font></a></a>');
document.writeln('<hr width="100%" size="1" color="#999999">');
document.writeln('<a href="http://www.souwang.com/user.php" target="_blank"><strong><font color="#FF0000">免费广告</font></strong></a>&nbsp;|&nbsp;');
document.writeln('<a href="http://www.souwang.com/help/t1.html" target="_blank"><strong><font color="#FF0000">向站长特别推荐：打造自己的个性化搜索引擎</font></strong></a>');
document.writeln('</td>');
document.writeln('</tr>');
document.writeln('</table>');
document.writeln('<table width="760" border="0" cellspacing="0" cellpadding="1" bgcolor="#d4e2ff" background="http://www.souwang.com/images/bg1.gif" align="center">');
document.writeln('<tr>');
document.writeln('<td align="center">');
document.writeln('<table border="0" cellpadding="2" cellspacing="0">');

function sc() {
	if (document.all.search.q.value=="") {
		document.all.search.q.focus();
		return false;
	}
	if(document.all.search.scch[0].checked) document.all.search.type.value=1;
	//if(document.all.search.scch[1].checked) document.all.search.type.value=3;
	if(document.all.search.scch[1].checked) {
		location.href="http://image.souwang.com/search.php?page=1&p="+document.all.search.q.value;
		return false;
	}
}

document.writeln('<form action="http://www.souwang.com/search" name="search" onsubmit="return sc()">');
document.writeln('<tr>');
document.writeln('<td><input type="hidden" name="type" value="1"></td>');
document.writeln('<td nowrap><input type="text" size="38" name="q"></td>');
document.writeln('<td><input type="submit" value="搜&nbsp;索" style="background-image: url(http://www.souwang.com/images/btn1.gif);width: 67px;height:24px;font-size: 14px;border-width: 0px;background-repeat: no-repeat;padding: 0px;"></td>');
document.writeln('<td>&nbsp;&nbsp;<input type="Radio" name="scch" checked>网页</td>');
document.writeln('<td><input type="Radio" name="scch">图片</td>');
document.writeln('</tr>');
document.writeln('</form>');
document.writeln('</table>');
document.writeln('</td>');
document.writeln('</tr>');
document.writeln('</table>');

// Cookies 处理脚本
function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}

function Delete_Cookie(name,path,domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function setHP() {
	try {
		var hp = document.getElementById('hp');
		if (!hp.isHomePage('http://www.souwang.com/')) {
			hp.style.behavior='url(#default#homepage)';
			hp.setHomePage('http://www.souwang.com/');
		}
	} catch(e) {}
}

var today = new Date();
var expires_date = new Date(today.getTime() + 1 * 86400000); // 3天|毫秒
var opennew = Get_Cookie('memail_open');
if (opennew == null) {
	//document.writeln('<body onunload="setHP();"');
    //top.window.document.body.onUnload=setHP();
    //window.open("http://www.souwang.com/");
    Set_Cookie('memail_open', expires_date, expires_date, '/');
}
//document.writeln('<body onbeforeunload="setHP();"');
//Delete_Cookie('memail_open');

document.writeln('<span id=hp style="behavior:url(#default#homepage)"></span>');