var IN_MAIN = true;
var uname = '';

String.prototype.empty = function(){
	return (this.length==0) ? 1 : 0;
}


String.prototype.MaxLength = function(){
	var len = arguments[0] ? arguments[0] : 100;	//给它指定100的默认值
	if(this.length>len){
		return 1;
	}else{
		return 0;
	}
}

function changePicture2(){
	document.getElementById("yzmpicd").src = PATH + 'includes/yz.php?d='+new Date;
}

String.prototype.chkemail = function (){
	return this.match(/(\w|\.|_|-)+@\w+\.\w+/i);
}


//判断用户是否登陆，用户的COOKIE
$(function(){
	$(".footleft p").eq(1).html("本网站版权归上海光明奶酪黄油有限公司所有 上海市吴ss路578号 <a href='mailto:52cheese@gmail.com'>联系ss我们</a>")
	var cStr = document.cookie;
	if (cStr!='' && cStr.indexOf('; uname=')!=-1) {
		var d = cStr.indexOf('; uname=');
		var cStr2 = cStr.substr((d + 8));
		var i = cStr2.indexOf(';');	
		if(i==-1){
			uname = cStr2;
		}else{
			uname = cStr2.substr(0,i);
		}

		$("#head .login").html('欢迎：'+ uname + '&nbsp;&nbsp;<a href="loginout.php">[退出]</a>');
		$("#head .topnav").css("right",$("#head .login").width()+20+"px");
	}else{
		$("#head .topnav").css("right",$("#head .login").width()+20+"px");
		//$(".login a:first").addClass("thickbox").attr("href","javascript:window.open('login.php','_blank');javascript:void(0);");
		//$(".login a:last").addClass("thickbox").attr("href","javascript:window.open('register.php','_blank');javascript:void(0);");
		$(".login a:first").addClass("thickbox").attr("href",'login.php?act=AjaxLoginWidget&amp;loginCID=1&amp;TB_iframe=true&amp;height=364&amp;width=335');
		$(".login a:last").addClass("thickbox").attr("href",'register.php?act=AjaxLoginWidget&amp;loginCID=1&amp;TB_iframe=true&amp;height=488&amp;width=450');
	}
	
	//google 统计代码

	
});


function googleCode(){
	var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', 'UA-16756015-2']);
	  _gaq.push(['_trackPageview']);
	
	  (function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? ' https://ssl' : ' http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();	
}
