// JavaScript Document 
function browser_check() {
	var originalWindowLocation = window.location + "";
	var newWindowLocation;
	var server = 'http://' + window.location.hostname + '';
	var regexiPad = new RegExp(/iPad/);
	
	if( regexiPad.exec(navigator.userAgent) ) {
		newWindowLocation = server + '/ipad/';
		if( -1 == originalWindowLocation.indexOf(newWindowLocation) 
			&& -1 == originalWindowLocation.indexOf(server+"/contact") 
			&& -1 == originalWindowLocation.indexOf(server+"/download/download.html")) {
			//alert(newWindowLocation + window.location.hash);return;
			
			var jumpTo = newWindowLocation;
			var shareMsq = jQuery.url.param("shareMsq");
			var shareAsq = jQuery.url.param("shareAsq");
			var tempTest = new RegExp(/pvg_new/);
			var segId = 0;
			var directory = jQuery.url.attr('directory');
			if(tempTest.exec(directory)) segId = 1;
			var ipadDirectory = jQuery.url.segment(0);
			if(!ipadDirectory||ipadDirectory.indexOf("index.html")!=-1){
				window.location = jumpTo + window.location.hash;
				return;
			}
			jumpTo = newWindowLocation+ipadDirectory+"/";
			if(typeof(shareMsq)!='undefined'&&shareMsq!=''){
				jumpTo += "?shareMsq="+shareMsq;
				if(typeof(shareAsq)!='undefined'&&shareAsq!=''){
					jumpTo += "&shareAsq="+shareAsq;
				}
			}
			window.location = jumpTo + window.location.hash;
		}
	}
}
browser_check();

function shareAct(type,title,shid){
	//var mailsub = title;
	//title = title.replace(/<[^>].*?>/g,""); 
	var host = jQuery.url.attr('host');
	var path = jQuery.url.attr('path');
	var shareurl = 'http://'+host+path+"?shareAsq="+shid+"&shareMsq="+static_id+" ";
	shareurl = encodeURIComponent(shareurl);
	//title = encodeURIComponent(title);
	if("share_mail"==type){
		window.open("mailto:?subject="+title+"&body="+title+" \r\n"+shareurl+"&encode=javascript");
	}else if("share_digg"==type){
		window.open("http://digg.com/tools/diggthis/submit?title="+title+"&url="+shareurl);
	}else if("share_facebook"==type){
		window.open("http://www.facebook.com/sharer.php?u="+shareurl+"&t="+title);
	}else if("share_delicious"==type){
		window.open("http://delicious.com/save?v=5&url="+shareurl+"&t="+title);
	}else if("share_twitter"==type){
		window.open("http://twitter.com/home?status=Currently reading "+shareurl);
	}else if("share_sinaweb"==type){
		window.open("http://v.t.sina.com.cn/share/share.php?title="+title+"&url="+shareurl);
	}else if("share_linkedln"==type){
		window.open("http://www.linkedin.com/shareArticle?mini=true&url="+shareurl+"&title="+title+"&source="+shareurl);
	}else if("share_qq"==type){
		window.open("http://v.t.qq.com/share/share.php?title="+title+"&url="+shareurl);
	}else if("share_reddit"==type){
		window.open("http://www.reddit.com/submit?url="+shareurl+"&title="+title);
	}else if("share_sohu"==type){
		window.open("http://t.sohu.com/third/post.jsp?url="+shareurl+"&title="+title+"&content="+title);
	}
}
 
function otherhide(){
	
	$(".menudownlist").hide();
	$(".fanmenudownlist").hide();
	}
	
	
function show(divName)
 {
   var divObject=document.getElementById(divName);
   divObject.style.display="block";
   divObject.style.visibility="visible";
 }
 
function hide(divName)
 {
   var divObject=document.getElementById(divName);
   divObject.style.display="none";
 }
 
function check_version(id,vs,dir,newsid)
{  
	var params = "static_id="+id+"&version="+vs+"&newsid="+newsid;
	//alert(params);//return;
	$.ajax({
       url: dir+'check_version.php', 
       type:'post',         
       dataType:'string',     
       data:params,         
       success:check_result 
     });   
}

function check_result (htmlurl)
{
	htmlurl = htmlurl.toString();
	//alert(htmlurl);//return;
	var getArr=htmlurl.split("|");
	htmlurl=getArr[1];
	//alert(htmlurl);
	if(htmlurl!="no"&&typeof(htmlurl)!="undefined")
	{
		//alert(htmlurl);return;
	   window.location.href=htmlurl;
	}//else{
		//alert(htmlurl+"==no");return;
	//}
} 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
jQuery(document).ready(function() {

//alert($.client.os+"|"+$.client.browser);
var os=$.client.os;
var browser=$.client.browser;
if(browser=="Safari")
{
  $(".rightcontbar").css("padding-bottom","15px");
}
});
