function doOnLoad(){
	for(var i=1;i<9;i++){
		//document.all["main_div"+i].style.left = document.getElementById("main_btn"+i).offsetLeft;
		var id = "main_div"+i;
		$("#"+id).css("left",$("#main_btn"+i).offset().left);
	}
	document.getElementById("main_div_mouse").style.left = document.getElementById("main_btn1").offsetLeft;
}
var outTime;
//鼠标经过主菜单事件
function doMainOver(btn_id){
	var id = "main_div"+btn_id;
	$(".main_div_sub").each(function(){
		if($(this).attr("id") != id){
			$(this).hide();
		}
	});
	outTime = setTimeout(function(){
		$("#"+id).fadeIn("normal");
	}, 200);
}

function addBookMark(){
	if (document.all){
        window.external.addFavorite(location.href,document.title);
    }else {
       window.sidebar.addPanel(location.href,document.title); 
    }
}
$(function(){
	doOnLoad();
	
	//投资者关系[new]
	$(".new_leftmenu").mouseover(function(){
		$(this).removeClass().addClass("new_leftmenu_click");
	}).mouseout(function(){
		$(this).removeClass("new_leftmenu_click").addClass("new_leftmenu");
	});
	
	$(".leftmenu").mouseover(function(){
		$(this).addClass("leftmenu_click");
	}).mouseout(function(){
		$(this).removeClass("leftmenu_click");
	});
	
	$(".main_div_sub_font").mouseover(function(){
		$(this).attr("className","main_div_sub_font2");
	}).mouseout(function(){
		$(this).attr("className","main_div_sub_font");
	});
	$(".main_div_sub").bind("mouseleave",function(){
		$(this).hide();
	});
	$(".main_btn")
	.mouseout(function(){
		$(this).removeClass("main_btn2");
		$(this).removeClass("main_btn3");
		if(outTime)
			clearTimeout(outTime);
	})
	.mouseover(function(){
		$(this).addClass("main_btn2");
		var btn_id = this.id;
		var idIndex = btn_id.charAt(btn_id.length - 1);
		doMainOver(idIndex);
	});
});
//搜索
function doSearch(){
	var link = "http://www.google.com/search?domains=http://www.powerlong.com&sitesearch=http://www.powerlong.com&q="+$("input[name='search_text']").val();
	window.open(link);
}

var request = {
		QueryString : function(val) {
			var uri = window.location.search;
			var re = new RegExp("" + val + "\=([^\&\?]*)", "ig");
			return ((uri.match(re)) ? (uri.match(re)[0].substr(val.length + 1))
					: null);
		},
		QueryStrings : function() {
			var uri = window.location.search;
			var re = /\w*\=([^\&\?]*)/ig;
			var retval = [];
			while ((arr = re.exec(uri)) != null)
				retval.push(arr[0]);
			return retval;
		},
		setQuery : function(val1, val2) {
			var a = this.QueryStrings();
			var retval = "";
			var seted = false;
			var re = new RegExp("^" + val1 + "\=([^\&\?]*)$", "ig");
			for ( var i = 0; i < a.length; i++) {
				if (re.test(a[i])) {
					seted = true;
					a[i] = val1 + "=" + val2;
				}
			}
			retval = a.join("&");
			var rtnVal=  "?" + retval
					+ (seted ? "" : (retval ? "&" : "") + val1 + "=" + val2);
			
			return rtnVal;
		},
		toLang: function (val1, val2){
			var url2=this.setQuery(val1,val2);
			window.location.href=url2;
			//window.location.href="/powerlong/pl/main.action"+url2;
			//top.location="${ctx}/pl/main.action"+url2;
		}
	};


