 function openpopup(x,y,img,tittle)
   {

   if( x> window.screen.availWidth || y > window.screen.availHeight )
		{
			if( x > screen.availWidth){x=screen.availWidth-20;}
			if( y > screen.availHeight){y=screen.availHeight-25;}
				
	 			
        	url = "popup.php?img=" + img + "&title=" + tittle;
            myupload = window.open(url,'popupload','titlebar=no,scrollbars,resizable=yes,width='+ x +',height='+y);
		}else{
			url = "popup.php?img=" + img + "&title=" + tittle;
	    	myupload = window.open(url,"popupload","titlebar=no,scrollbars=no,resizable=yes,width="+x+",height="+y);
		}
   if (window.focus) {myupload.focus()}

   }

