function ajax(a){
	var h = getUniqueId() ;
	if(!a.b) a.b='';
	if(!a.c) a.c=function(){};
	if(!a.d) a.d=function(){};
	return jQuery.ajax({
		url:a.a+'',
		data:a.b,
		type:'POST',
		dataType:'php',		
		error: a.c,
		success: a.d
	});
}
function ajaxfile(a){
	var h = getUniqueId() ;
	if(!a.b) a.b='';
	if(!a.c) a.c='';
	if(!a.d) a.d='';
	if(!a.e) a.e='';
	if(!a.f) a.f=function(){};
	if(!a.g) a.g=function(){};	
	return jQuery.ajaxFileUpload({
		url:a.a+'',
		secureuri:false,
		fileElements:a.b,
		preForm:a.c,
		prePost:a.d,
		data:a.e,
		type:'POST',
		dataType:'php',	
		error: a.f,
		success: a.g
	});
}
Math.uuid = (function() {
  // Private array of chars to use
  var CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); 

  return function (len, radix) {
    var chars = CHARS, uuid = [];
    radix = radix || chars.length;

    if (len) {
      // Compact form
      for (var i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
    } else {
      // rfc4122, version 4 form
      var r;

      // rfc4122 requires these characters
      uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
      uuid[14] = '4';

      // Fill in random data.  At i==19 set the high bits of clock sequence as
      // per rfc4122, sec. 4.1.5
      for (var i = 0; i < 36; i++) {
        if (!uuid[i]) {
          r = 0 | Math.random()*16;
          uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
        }
      }
    }

    return uuid.join('');
  };
})();
function getUniqueId(){     
     return Math.uuid();
};
function blank(){}
function callFn(a, b){
	if(!b)b='';
	_w.setTimeout(a+'('+b+')', 1);
}
function scrollToAnchor(a, b, c){
	if(!b) b=function(){};
	if(!c) c=1000;
  	$objhash = '#'+a ; 
	var $target = $($objhash);
	$target = $target.length && $target || $('[name=' + $objhash.slice(1) +']');
	if ($target.length) {
		var targetOffset = $target.offset().top;
		$('html,body').animate({scrollTop: targetOffset}, c, '', b);
		return false;
	}  
};
function openCMWindow(url, w, h){ dWin = dhtmlmodal.open("oWindow", "iframe", url, '', "width="+w+"px,height="+h+"px,center=1,resize=1,scrolling=1", "recal"); dWin.statusarea.style.display = 'none' ; dWin.handle.style.display = 'none' ; dWin.contentarea.style.paddingTop = '0px' ; dWin.contentarea.style.paddingLeft = '0px' ; dWin.contentarea.style.paddingRight = '0px' ; dWin.contentarea.style.paddingBottom = '0px' ; dWin.contentarea.style.borderStyle = 'none' ; dWin.style.borderStyle = 'none' ; window.top.dWin=dWin; return dWin ; }
function openInlineWindow(content, w, h){ dWin = dhtmlmodal.open("oWindow", "inline", content, '', "width="+w+"px,height="+h+"px,center=1,resize=1,scrolling=1", "recal"); dWin.statusarea.style.display = 'none' ; dWin.handle.style.display = 'none' ; dWin.contentarea.style.paddingTop = '0px' ; dWin.contentarea.style.paddingLeft = '0px' ; dWin.contentarea.style.paddingRight = '0px' ; dWin.contentarea.style.paddingBottom = '0px' ; dWin.contentarea.style.borderStyle = 'none' ; dWin.style.borderStyle = 'none' ; window.top.dWin=dWin; return dWin ; }
function closeCMWindow(){window.top.dWin.hide();}
function replaceQuotes(str){ str=str.replace("'", "") ; return str.replace('"', '') ;}
function IntCast($Num){$Num = parseInt($Num, 10); return isNaN($Num)?0:$Num;}
function FloatCast($Num){$Num = parseFloat($Num); return isNaN($Num)?0:$Num;}

function CreateFullWindow(WinURL, WinName, WinFeatures){
	var hdwin = window.open(WinURL, WinName, WinFeatures)
	hdwin.moveTo(0, 0);
	width = screen.availWidth;
	height = screen.availHeight;
	hdwin.resizeTo(width, height);
	if (hdwin.focus) hdwin.focus();
}

function createCenterWin(Url, WindowName, Features, W, H){	
		var top = 0 ;
		var left = 0 ;
		var hToWin = null ;
		
		if (screen.availWidth) left = (screen.availWidth/2) - (W/2)
		if (screen.availHeight) top = (screen.availHeight/2) - (H/2)
		
		FeaturesArray = Features.split(",") ;
		FeaturesArray[FeaturesArray.length] = "width=" + W ;
		FeaturesArray[FeaturesArray.length] = "height=" + H ;		
		FeaturesArray[FeaturesArray.length] = "top=" + top ;
		FeaturesArray[FeaturesArray.length] = "left=" + left ;
		hToWin = window.open('', WindowName, FeaturesArray.join(",")) ;
		try{hToWin.document.open(); hToWin.document.title='Loading...'; hToWin.document.close();}catch(err){}
		hToWin.location.href=Url;
		return hToWin;
}

function CreateCenterWindow(WinURL, WinName, WinFeatures, width, height){
	
	width = screen.width ? ( screen.width - 25 < width ? screen.width - 25 : width) : width;
	height = screen.height ? ( screen.height - 25 < height ? screen.height - 25 : height) : height;
	leftpos = screen.width ? (screen.width / 2) - (width/2) : 0;
	toppos = screen.height ? (screen.height / 2) - (height/2) : 0;
	leftpos = Math.round(leftpos)
	toppos = Math.round(toppos)
	
	if (WinFeatures)
	{
		WinFeatures = WinFeatures + ",left=" +	leftpos + ",top=" + toppos + ",width=" + width + ",height=" + height
	}
	else
	{
		WinFeatures = "left=" +	leftpos + ",top=" + toppos + ",width=" + width + ",height=" + height
	}
	
	var hdwin = window.open(WinURL, (WinName ? WinName : "") , WinFeatures)

	if (hdwin.focus) hdwin.focus();
}
function encodeUrlString(str){
	var encodedStr;
	if( !encodeURIComponent ){
		encodedStr = escape(str);
		encodedStr = encodedStr.replace(/@/g, '%40');
		encodedStr = encodedStr.replace(/\//g, '%2F');
		encodedStr = encodedStr.replace(/\*/g, '%2B');
	}
	else{
		encodedStr = encodeURIComponent(str);
		encodedStr = encodedStr.replace(/-/g, '%7E');
		encodedStr = encodedStr.replace(/!/g, '%21');
		encodedStr = encodedStr.replace(/\(/g, '%28');
		encodedStr = encodedStr.replace(/\)/g, '%29');
		encodedStr = encodedStr.replace(/\(/g, '%28');
		encodedStr = encodedStr.replace(/\'/g, '%27');
	}
	encodedStr = encodedStr.replace(/\%20/g, '+');
	return encodedStr;
}
if(_J.blockUI){
	_J.blockUI.defaults.applyPlatformOpacityRules = false;
	_J.blockUI.defaults.overlayCSS.backgroundColor = '#000'; 
	_J.blockUI.defaults.overlayCSS.opacity = .8; 
}

function dvBlockClass(d) {
	this.d=d;
	this.b=function(){
		try{
			_J(this.d).block({
				message: '<img src="'+_w.loaderpath+'" />',
				css: {
					border: 'none',
					backgroundColor: 'transparent'
				}
			});
		}catch(err){}
	}	
	this.u=function(){
		try{_J(this.d).unblock() ;}catch(err){}
	}
}

function startBlocking(dvid){
	if(dvid==undefined)
		dvid=null;
	try{blockDisply(dvid);}catch(err){}
}
function stopBlocking(dvid){
	try{UnBlockDisply();}catch(err){}
}
function blockDisply(dvid){
	stopBlocking();
	if(dvid==undefined)
		dvid=_w.defAjaxDiv;
	_w.defAjaxDiv=dvid;
	_J('#'+_w.defAjaxDiv).block({
		message: '<img src="'+_w.loaderpath+'" />',
		css: {
			border: 'none',
			backgroundColor: 'transparent'
		}
	});
}
function UnBlockDisply(){	
	try{_J('#'+_w.defAjaxDiv).unblock() ;}catch(err){}
}

function jParser(content){
	var parserElem = _J('#jquerycontentparser');
	if( parserElem.length==0 ){
		_J('<div id="jquerycontentparser" style="display:none"></div>').appendTo(document.body);
		parserElem = _J('#jquerycontentparser');
	}
	parserElem.html(content).empty();
}
function stopBrowserLoading(){
	try{window.document.execCommand('Stop');}catch(err){}
	try{window.stop();}catch(err){}
}

function setasHome(url){
	try{
		if (document.all){
			document.body.style.behavior='url(#default#homepage)';
			document.body.setHomePage(url); 
		}
		else if (window.sidebar){
			if(window.netscape){
				try{  
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
				}  
				catch(e){  
					alert("this action was aviod by your browser,if you want to enable, please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");  
				}
			} 
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage', url);
		}
	}catch(err){}
}
function bookmarkSite(title,url){
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
		window.external.AddFavorite(url, title);
}
function encodeUriC(str){
	str = (str+'').toString();    
    return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').
                                                                    replace(/\)/g, '%29').replace(/\*/g, '%2A');
}
function decodeUriC(str){
	return decodeURIComponent(str);
}