//left menu begin
if (typeof(ctx)!='undefined') {
 var on_img=ctx + "../images/icon01.gif";
 var off_img=ctx + "../images/icon11.gif";
} else {
 var on_img="../images/icon11.gif";
 var off_img="../images/icon01.gif"; 
}
window.onload = function a()
{
		var curShow = readCookie('curShow');
		if(curShow!=''&&curShow!=null)
		{
			var arr_curShow;
			arr_curShow = curShow.split(',');
			for(i=0;i<=arr_curShow.length-1;i++)
			{
				if(arr_curShow[i]!='')
				{
					document.getElementById(arr_curShow[i]).style.display="";
					image='img'+arr_curShow[i];
					var finalImage=eval(image);
					finalImage.src=on_img;
				}
			}
		}
}

function ShowAll( num ){
	var values="";
	for(var i=0;i<num;i++){
		var count=i+1;
		values+=count;
		if(i!=num){values+=',';}
	}
	writeCookie('curShow',values,12);
		for (i=0;i<num;i++)
		{	
			var count=i+1;				
			var obj1=document.getElementById(count);
			var obj2=document.getElementById('img'+count);
			if(obj1.style.display=="none"){
				obj1.style.display="";
			}
			obj2.src=on_img;
		}			
}
function CloseAll( num ){
		writeCookie('curShow','',12);
		for (i=0;i<num;i++)
		{	
			var count=i+1;				
			var obj1=document.getElementById(count);
			var obj2=document.getElementById('img'+count);
			if(obj1.style.display==""){
				obj1.style.display="none";
			}
			obj2.src=off_img;
		}			
	}
			
			
function Show(id,i_id){
	
	var obj=document.getElementById(id);
	if(obj.style.display=="none"){
			obj.style.display="";
	i_id.src=on_img;
				
	var curShow = readCookie('curShow');
	if(curShow!='')
	{
	var arr_curShow = curShow.split(',');
	var found = false;
	for(i=0;i<arr_curShow.length-1;i++)
	{
		if(arr_curShow[i].toString()==id) {found=true;}
	}
	if(!found){writeCookie('curShow',curShow+','+id,12)}
	}
	else {
	writeCookie('curShow',id,12)
	}
			
	}else{
			obj.style.display="none";
	i_id.src=off_img;
				
	var curShow = readCookie('curShow');
	if(curShow!='')
	{
	var arr_curShow = curShow.split(',');
	for(i=0;i<arr_curShow.length;i++)
	{
		if(arr_curShow[i].toString()==id) {arr_curShow=arr_curShow.del(i--);}
	}
	curShow = arr_curShow.join(',');
	writeCookie('curShow',curShow,12)
	}
	}
}

function readCookie(name){
		var cookieValue = "";
		var search = name + "=";
		if(document.cookie.length > 0)
		{ 
			offset = document.cookie.indexOf(search);
			if (offset != -1)
			{ 
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			cookieValue = unescape(document.cookie.substring(offset, end))
			}
		}
		return cookieValue;
	}

function writeCookie(name, value, hours){
		var expire = "";
		if(hours != null)
		{
			expire = new Date((new Date()).getTime() + hours * 3600000);
			expire = "; expires=" + expire.toGMTString();
		}
		document.cookie = name + "=" + escape(value) + expire;
		}
		Array.prototype.del=function(n) {  
		if(n<0) 
			return this;
		else
			return this.slice(0,n).concat(this.slice(n+1,this.length));
}



//new
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"label":"";
con.style.display=i==cursel?"block":"none";
}
}



/*open and close windows*/
function  opennews01(url){   
  window.open(url,"","scrollbars=no,width=750,height=550,left="+(window.screen.width-750)/2+",top="+(window.screen.height-500)/2+'"');}   

function shutwin(){
window.close();
return;}

