function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function checkCookie()
{
	iopnum=getCookie('iopnum');
	rezsize=getCookie('rezsize');
	if (iopnum!=null && iopnum!="")
 		{
	 	iopnum = iopnum;
		rezsize = rezsize;
 		}
	else
  	{
	if(screen.width<1024||screen.height<768){
		iopnum=3;
		rezsize=1;
	}
	else if(screen.width<1280&&screen.height<1024){ //1024x768 default view, same as above but without the notification
		iopnum=3;
		rezsize=2;
	}
	else if(screen.width<1281&&screen.height<1025){ //1280x1024 view
		iopnum=4;
		rezsize=3;
	}
	else if(screen.width<1441||screen.height<901){ //1440x900 view
		iopnum=5;
		rezsize=4;
	}
	else { //large sizes
		iopnum=5;
		rezsize=5;
	}

	setCookie('iopnum',iopnum,365);
	setCookie('rezsize',rezsize,365);
	}
}
