function trim(txt){txt = txt.replace(/^\s+/g,"");txt = txt.replace(/\s+$/g,"");return txt;};
function isDefine($val){if(typeof($val)!='undefined'){return true;}else{return false;}};
function isChinese(txt,id){reg =/^[\u4E00-\u9FA5]+$/;if(!reg.test(txt)){$("#"+id+"_tip").html(" ＊输入了非中文，请重新输入！");$("#"+id+"_tip").css("color","red");return false;}else{return true;}};
function getimage(o){if(o) {o.attr("src",url("member::account/getimg")+"&num="+Math.random());} else {o.attr("src",url("member::account/getimg")+"&num="+Math.random());}};
function jqueryAjax(url,data,success,extend){if(!success)success='success';if(!extend)extend='';var html = $.ajax({type: 'POST',url: url,data: data,success: function (e){call_user_func(success,e,extend);},dataType: "json"}).responseText;};
function in_array(str,arr){var i=0;for(i=0;i<arr.length;i++){if(arr[i]==str)return true;}return false;};
function gourl(url,frame){if(!isDefine(frame)){location.href=url;}else if(frame){top.frames[frame].location.href=url;}else{return false;}};function drop_confirm(msg, url){if(confirm(msg)){window.location = url;}};
function call_user_func (cb){var func;if (typeof cb === 'string'){func = (typeof this[cb] === 'function') ? this[cb] : func = (new Function(null, 'return ' + cb))();}else if(cb instanceof Array){func = (typeof cb == 'string') ? eval(cb + "['" + cb[1] + "']") : func = cb[cb[1]];}else if (typeof cb === 'function'){func = cb;}if (typeof func != 'function') {throw new Error(func + ' is not a valid function');}var parameters = Array.prototype.slice.call(arguments, 1);return (typeof cb === 'string') ? func.apply(eval(cb), parameters):(typeof cb!== 'object') ? func.apply(null, parameters) : func.apply(cb, parameters);};
function url(url_s){ 
    var temparr = Array();var base_url = '/';var namespace,controller,action;
    if(!url_s)return false;temparr = explode('::',url_s);namespace=temparr[0];
    temparr = explode('/',temparr[1]);controller = temparr[0];action  = temparr[1];
    return base_url+'?'+'namespace='+namespace+'&controller='+controller+'&action='+action;
    //return base_url+namespace+'/'+controller+'/'+action;
};
function implode (glue, pieces){var i = '',retVal = '',        tGlue = '';if (arguments.length === 1) {pieces = glue;glue = '';}    if (typeof(pieces) === 'object') {if (pieces instanceof Array) {return pieces.join(glue);} else {for (i in pieces) {retVal += tGlue + pieces[i];tGlue = glue;}return retVal;}    } else {return pieces;}};function explode (delimiter, string, limit){var emptyArray = {0: '' };if (arguments.length < 2 || typeof arguments[0] == 'undefined' || typeof arguments[1] == 'undefined')return null;if (delimiter === '' || delimiter === false || delimiter === null) {return false;}if (typeof delimiter == 'function' || typeof delimiter == 'object' || typeof string == 'function' || typeof string == 'object') {return emptyArray;}if (delimiter === true) {delimiter = '1';}if (!limit){return string.toString().split(delimiter.toString());} else {var splitted = string.toString().split(delimiter.toString());var partA = splitted.splice(0, limit - 1);var partB = splitted.join(delimiter.toString());partA.push(partB);return partA;}};
function getFavicon(){if (checkBroswer('IE')){document.write('<link rel="shortcut icon" href="http://media.zk666.com/favicon.ico"/>');} else {document.write('<link rel="shortcut icon" href="http://media.zk666.com/favicon.gif"/>');}}
function checkBroswer(type){var browser=navigator.appName;var b_version=navigator.appVersion;var version = new Array();var trim_Version;var FF = (navigator.userAgent.indexOf("Firefox")!=-1);var IE = (navigator.userAgent.indexOf("MSIE")!=-1);if(!type)return false;if(type=='FF'){if(FF)return true;else return false;}version=b_version.split(";");if(!version[1])return false;trim_Version=version[1].replace(/[ ]/g,"");if (type=='IE'){if (browser=="Microsoft Internet Explorer")return true;else return false;} else if (type=='IE6')	{if (browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0")return true;else return false;} else if (type='IE7') {if (browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0")return true;else return false;}return false;};
function selAll(){$("input[name='arcID[]']").each(function(){$(this).attr("checked",true);});};
function noSelAll(){$("input[name='arcID[]']").each(function(){$(this).attr("checked",false);});};
function getimage(){$("#img-code").attr("src",url("member::account/getimg")+"&"+Math.random());}
function getAdver(url, file, width, height, type)
{
	var obj    = '';
        if (type==1)
        {
            obj = '<a target=_blank href='+url+'><img src='+file+' width='+width+' height='+height+' /></a>';
        } else {
	obj = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width='+width+' height='+height+'>'
    +'<param name="movie" value='+file+' />'
    +'<param name="quality" value="high" />'
	+'<param name="wmode" value="transparent"/>'
    +'<embed src='+file+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="'+width+'" height="'+height+'"></embed>'
+'</object>';
        }
	document.write(obj);
}
