// JavaScript Document
document.title = "广汽丰田";
var CopyRight = "&copy; 2005-2009 广汽丰田汽车有限公司  版权所有";

function isJSP() {
	if (location.href.indexOf(".jsp")>-1) {
		return true;
	}else {
		return false;
	}
}
function opwin(id,catid){
	//alert("id"+id);
	//var pop = window.open("../index/op_win.jsp?id="+id,"newwindow","width=650,height=400,toolbar=0,menubar=0,scrollbars=yes,location=0,resizable=1");
	//pop.focus();
	var left = (screen.width - 630) / 2;
	var top = (screen.height - 500) / 2;
	var link ="";
	if (isJSP())
	{
		link="/2006/index/op_win2.jsp?" + (catid ? ("catid=" + catid + "&") : "") + "id=" + id;
	}
	else {
		link="/2006/index/op_win2_jsp_catid_"+catid+"_id_"+id+".html";
	}
		var news = window.open(link, "news", "width = 630, height = 500, scrollbars = 1, left = " + left + ", top = " + top + ", resizable = 1");
	news.focus();
}

function NEWSopwin(id,catid){
	//alert("id"+id);
	//var pop = window.open("../index/op_win.jsp?id="+id,"newwindow","width=650,height=400,toolbar=0,menubar=0,scrollbars=yes,location=0,resizable=1");
	//pop.focus();
	var left = (screen.width - 630) / 2;
	var top = (screen.height - 500) / 2;
	var link ="";
	if (isJSP())
	{
		link="../index/news_op_win.jsp?" + (catid ? ("catid=" + catid + "&") : "") + "id=" + id;
	}
	else {
		link="../index/news_op_win_jsp_catid_"+catid+"_id_"+id+".html";
	}
		var news = window.open(link, "news", "width = 630, height = 500, scrollbars = 1, left = " + left + ", top = " + top + ", resizable = 1");
	news.focus();
}

function setUser(username)
 {
 	document.cookie="user="+username;
 }
 function getCookieStr()
 {
 	var cookieStr=document.cookie;
 	var cookieArray=new Array();
 	if (cookieStr.indexOf("; ")) {
 		var tempArray=cookieStr.split("; ");
 		for (i=0;i<tempArray.length;i++) {
 			if (tempArray[i].indexOf(",")>-1) {
 				var tempArray2=tempArray[i].split(",");
 				for (j=0;j<tempArray2.length;j++) {
 					cookieArray.push(tempArray2[j]);
 				}
 			} else 
 			{
 				cookieArray.push(tempArray[i]);
 			}
 		}
 	} else if (cookieStr.indexOf(",")) {
 		cookieArray=cookieStr.split(",");
 	} else {
 		cookieArray[0]=cookieStr;
 	}
 	return cookieArray;
 }
function searchKeyItem(array,key) {
 	var output="";
 	if (array.length>0) {
 		for (var i=0; i<array.length;i++) {
 			if (array[i].toString().indexOf(key)>-1) {
 				output=array[i];
 				break;
 			}
 		}
 		
 	}
 	return output;
 }
 function parseStr(str) {
 	 var output=searchKeyItem(getCookieStr(),str);
 	 if (output.indexOf("=")>-1) {
 	 	return output.substring(output.indexOf("=")+1);
 	 } else {
 	 	return "";
 	 }
 }
 function getUser() {
 	 return parseStr("user") == "" ? "" : parseStr("user");
 }
 
 
 function n1(formname){
		if(formname.keyword.value=="全文搜索"){
			formname.keyword.value = "";
			formname.keyword.style.textAlign = "left";
		}
	
	}
	function checkSearch(v){
		if(v=="全文搜索"){
			alert("请输入需要搜索的关键词");
			return false;
		}
	}



function openWindows(link)
{
	var left = (screen.width - 630) / 2;
	var top = (screen.height - 500) / 2;
	var indexPop = window.open(link, "indexPop", "width = 1001, height = 1001, scrollbars = 1, left = " + left + ", top = " + top + ", resizable = 1");
	indexPop.focus();
}