// JavaScript Document
 function getObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
}
function tourl(url)
{
	window.location.href=url;
}
/*创建ajax对象*/
function add_ajax()
{
	var xmlhttp=null;
	try
	{
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			xmlhttp=null;
		}
	}
	if(!xmlhttp && typeof XMLHttpRequest != "undefined")
	{
		xmlhttp=new XMLHttpRequest();
	}
    return xmlhttp;
}

/*根据url来处理ajax的信息*/
function get_ajax(url)
{
	var xmlhttp = add_ajax();
	var randname = "rand"+Math.floor(Math.random()*10000);
	var randnum = Math.floor(Math.random()*10000);
	if(url.indexOf("?") != -1)
	{
		url += "&"+randname+"="+randnum;
	}
	else
	{
		url += "?"+randname+"="+randnum;
	}
	xmlhttp.open("GET",url,false);
	xmlhttp.send(null);
	if(xmlhttp.readyState==3)
	{
		alert("数据加载中...");
	}
	else if(xmlhttp.readyState == 4)
	{
		var result = xmlhttp.responseText;
		if(result)
		{
			return result;
		}
		else
		{
			return false;
			//alert("网络原因，请刷新后重新提交");
		}
	}
}
function menuTo(filename)
{
	var url= 'index.php?file='+filename;
	tourl(url);
}
function menuToProduct(pid)
{
	var url= 'index.php?file=Product&pid='+pid;
	tourl(url);
}
function menuToArtitle(pid)
{
	var url= 'index.php?file=Artitle&pid='+pid;
	tourl(url);
}
function menuToPhoto(pid)
{
	var url= 'index.php?file=Photo&pid='+pid;
	tourl(url);
}
function haoValidate(source){
	wval = trim(f.word.value);
	if (f.sc.value=="post")
	{
	    f.kw.value=f.word.value
		f.ct.value=""
		f.tn.value=""
		f.rn.value=""
		f.lm.value=""
		f.rs2.value=0
		f.myselectvalue.value=1
		f.ie.value=""
		f.cl.value=""
		f.z.value=""
		f.from.value=""
	  }
	if (f.sc.value=="img")
	{
		f.ct.value=201326592
		f.lm.value=-1
		f.cl.value=2
		f.tn.value="baiduimage"
		f.pv.value=""
		f.rs2.value=""
		f.myselectvalue.value=""
		f.ie.value=""
		f.z.value=0
		f.rn.value=""
		f.from.value=""
		f.f.value=""
		}
	if (f.sc.value=="zhidao")
	{
		f.ct.value=17
		f.tn.value="ikaslist"
		f.rn.value=10
		f.lm.value=""
		f.cl.value=""
		f.ie.value=""
		f.rs2.value=""
		f.f.value=""
		f.myselectvalue.value=""
		f.z.value=""
		f.from.value=""
		}
	if (f.sc.value=="web")
	{
	    f.cl.value=3
		f.tn.value="sitehao123"
		f.ct.value=0
		f.ie.value="gb2312"
		f.myselectvalue.value=""
		f.rn.value=""
		f.rs2.value=""
		f.z.value=""
		f.from.value=""
		f.lm.value=""
		}
	if (f.sc.value=="mp3")
	{
	    f.ct.value=134217728
		f.lm.value=-1
		f.rn.value=""
		f.cl.value=""
		f.tn.value="baidump3"
		f.f.value="ms"
		f.myselectvalue.value=""
		f.ie.value="gb2312"
		f.z.value=""
		f.from.value=""
		}
	if (f.sc.value=="news")
	{
	    f.tn.value="news"
		f.cl.value=2
		f.rn.value=20
		f.ct.value=0
	    f.z.value=""
		f.from.value="news"
		f.ie.value=""
		f.myselectvalue.value=""
		f.lm.value=""
		f.rs2.value=""
	    }
	   return true;
}
 function writeflashobject(parastr,swfname,width,height) 
	   { document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\""+width+"\" height=\""+height+"\" id=\"FlashVars\" align=\"middle\"\>\n"); 
	   document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" /\>\n"); 
	   document.write("<param name=\"movie\" value=\""+swfname+".swf\" /\>\n"); 
	   document.write("<param name=\"FlashVars\" value=\""+ parastr +"\" /\>\n"); 
	   document.write("<param name=\"quality\" value=\"high\" /\>\n"); 
	   document.write("<param name=\"bgcolor\" value=\"#ffffff\" /\>\n"); 
	   document.write("<embed src=\""+swfname+".swf\" quality=\"high\" bgcolor=\"#ffffff\" width=\""+width+"\" height=\""+height+"\" name=\"FlashVars\" align=\"middle\" allowScriptAccess=\"sameDomain\" FlashVars=\""+ parastr +"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /\>"); 
	   document.write("</object\>");
	   }
	   function getparastr() 
	   { var hrefstr,pos,parastr,para,tempstr1; 
	   hrefstr = window.location.href; 
	   pos = hrefstr.indexOf("?");
	   parastr = hrefstr.substring(pos+1);
	   return parastr;
	   }
