﻿function selCurrent(pValue,pName,pStype)
{
	var arrType=document.getElementsByName(pName);
	for(var i=0;i<arrType.length;i++)
	{
		
		if(arrType[i].getAttribute("s")==pValue)
			arrType[i].className=pStype;
		else
			arrType[i].className='';
	}
}

function fnVerify(pW,pH)
{
	var oCode=document.getElementById("cCode");
	oCode.value='';
	document.getElementById('cCodePic').src='verify.ashx?w='+pW+'&h='+pH+'&a='+Math.random();
}

String.prototype.Format=function()
{
  if(arguments.length==0) return this;
  for(var s=this, i=0; i<arguments.length; i++)
    s=s.replace(new RegExp("\\{"+i+"\\}","g"),arguments[i]);//或调用自定义函数 s=s.fnReplace("\\{"+i+"\\}",arguments[i]);
  return s;
}

var JSObject = {
	create: function() {
		return function() { this.init.apply(this, arguments); }
	}
}
var JSExtend = function(destination, source) {
	for (var property in source) {
		destination[property] = source[property];
	}
}

function fnGetDocumentClient()
{
    return {width:top.document.documentElement.clientWidth||top.document.body.clientWidth,height:top.document.documentElement.clientHeight||top.document.body.clientHeight}
}
//获取页面正文区域宽度、高度
function fnGetDocumentScroll()
{
    return {width:top.document.documentElement.scrollWidth||top.document.body.scrollWidth,height:top.document.documentElement.scrollHeight||top.document.body.scrollHeight}
}

function getObj(pName){return document.getElementById(pName).value;}

//p1 第一级选中
//p2 第二级选中
function setNav(p1,p2)
{
	$("li[s="+p1+"]>a")[0].className='navSel';
	$("li[s="+p1+"]").children('ul').show();
	
	if(p2)
		$("li[s="+p1+"]>ul>li[s="+p2+"]")[0].className='curSelect2';
	
	currentSelect=$(".nav>ul>li[s="+p1+"]");
}
var currentSelect='';
$(function(){
	var objNav=$('.nav>ul>li');
	
	$('.nav>ul>li').hover(
		function(){
			objNav.css('background','none');
			objNav.children('ul').hide();
			
			$(this).children('ul').show();
			$(this).css({background:'none'});
			
		},function(){
			currentSelect.children('ul').show();
			
			if($(this).attr('s')!=currentSelect.attr('s'))
				$(this).children('ul').hide();
			
			$(this).css({background:'none'});
		});
	
});
