/*
var artFontSize = 12;
function changeFontSize(symbol) {
	if(symbol=='+'){
		artFontSize = artFontSize + 2;
		$('article-content').style.fontSize = artFontSize+'px';
	}	
	if(symbol=='-'){
		artFontSize = artFontSize -2;
		$('article-content').style.fontSize = artFontSize+'px';
	}
	
	
}
*/
function changeFontSize(template) {
	$('article-content').style.fontSize = template.style.fontSize;
	var fontSize = template.style.fontSize;
	setCookie("fontSize",fontSize);
}


function parseUrl(){
//commnet by circle 
//for this function is no use now

//	var item,v;
//	var url = document.URL;
//	var loginURL = $('LoginScript').src;//('loginscript');
//	
//	item = url.substr(url.indexOf("?"));//.split('&');
//	item = item.substr(1);
//	item = item.split('&');
//	
//	for(var i=0;i<item.length;i++){
//		v = item[i].split("=");
//		if(v[0]=='__jat'){
//			loginURL = loginURL+"&"+item[i];
//		}
//	}
	//alert(loginURL);
}

function printPage(aid){
	location = hostURL+'/?channel=read&action=printArticles&aid='+aid;
}
function emailPage(aid){
	window.open(hostURL+'/?channel=read&action=share&aid='+aid, 'newwindow', 'height=480, width=500, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');
}
function turnSections(obj,item,category_id){
	switch(item){
		case "relatednews":
			obj.className = 'on';
			$('sec2').className ='';
			//$('sec3').className ='';
			$('related_section').style.display = 'block';
			$('other_section').style.display = 'none';
		break;		
		case "recommendnews":
			obj.className = 'on';
			$('sec1').className ='';
			//$('sec3').className ='';
			$('related_section').style.display = 'none';
			$('other_section').style.display = 'block';
			$('other_section').innerHTML = 'Loading...';
		 	var url = hostURL+'/index.php?';
			var pars = 'channel=home&action=getNewsForView&mode=1&cid='+category_id;
			var myAjax = new Ajax.Updater(
			{success: 'other_section'},
			url,
			{
				method: 'get',
				parameters: pars,
				onFailure: reportError,
				decay:3
			});
		break;		
		case "topnews":
			obj.className = 'on';
			$('sec1').className ='';
			//$('sec2').className ='';
		    $('related_section').style.display = 'none';
		    $('other_section').style.display = 'block';
			$('other_section').innerHTML = 'Loading...';
		 	var url = hostURL+'/index.php?';
			var pars = 'channel=home&action=getNewsForView&mode=0&cid='+category_id;
			var myAjax = new Ajax.Updater(
			{success: 'other_section'},
			url,
			{
				method: 'get',			
				parameters: pars,
				onFailure: reportError,
				decay:3
			});
		break;
	}

}
function reportError(){
	$('other_section').innerHTML = 'Sorry! Loading failed.';
}


function LoadRelateSections(tag){
	loadUserDefine();
	//loadKnowSec(tag);
	//loadLocalSec(tag);
	//loadPhotoSec(tag);
	//loadVideoSec(tag);

}

function loadLocalSec(tag){
	$('local_section').innerHTML = "Loading...";
	new Ajax.Request(hostURL+"/librarys/search_core.php?m=loadLocalSec&keyword="+tag,
	{
		onSuccess:function(request)
		{
	
			$('local_section').innerHTML = request.responseText;
		}
	});
}
function loadKnowSec(tag){
	$('know_section').innerHTML = "Loading...";
	new Ajax.Request(hostURL+"/librarys/search_core.php?m=loadKnowSec&keyword="+tag,
	{
		onSuccess:function(request)
		{
			$('know_section').innerHTML = request.responseText;
		}
	});
}
function loadVideoSec(tag){
	$('video_section').innerHTML = "Loading...";
	new Ajax.Request(hostURL+"/librarys/search_core.php?m=loadVideoSec&keyword="+tag,
	{
		onSuccess:function(request)
		{
			$('video_section').innerHTML = request.responseText;
		}
	});
}
function loadPhotoSec(tag){
	$('photo_section').innerHTML = "Loading...";
	new Ajax.Request(hostURL+"/librarys/search_core.php?m=loadPhotoSec&keyword="+tag,
	{
		onSuccess:function(request)
		{
			$('photo_section').innerHTML = request.responseText;
		}
	});
}
function loadUserDefine(){
	try{
		var fontsize = getCookie("fontSize");
		$('article-content').style.fontSize = fontsize; 
	}catch(e){
		
	}
}

 