function cleanup()
{
	var test = $(document).width();
	alert(test);

if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}


session.location.href='includes/sessionframe.php?process=1&width=' + frameWidth + '&height=' + frameHeight;


//var feature_outer_height = document.getElementById('featured_outer').offsetHeight;
//document.getElementById('featured').style.height = feature_outer_height - 50;




}




function resizeFrame() 
{		
		 	var OSName="Unknown OS";
		if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
		if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
		if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
		if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";

    var h = $(window).height();
    var w = $(window).width();
    var img_prev_width = w - 400;
    if (img_prev_width> 500)
    		img_prev_width = 500;
    
    
    var img_prev_height = 	Math.round((img_prev_width * .63));	
   	//alert(img_prev_height);
   	var page_table = h -5; 
   	var featured_outer = h - 145;
   	var featured = h - 165;
   	$("#page_table").css('height',page_table);
   	$("#featured").css('height',featured);
   	$("#featured_outer").css('height',featured_outer);
   	
   	if(w < 890)
   		{
   			
   			/*var feature_width = (w -30);
   			//$("#title_td").css('width',feature_width);
   			var image_wrap_width =  feature_width -40;
   			var scrollable_width =  feature_width -80;
   			
   			$("#featured_outer").css('width',feature_width);
   			$("#featured").css('width',(feature_width-25));
   			$("#wrapper_td").css('width',(w-10));   	
   			$("#image_wrap_img").attr("height",img_prev_height);
   			$("#image_wrap_img").attr("width",img_prev_width);
   			$("#image_wrap").css('width',image_wrap_width);
   			$("#scrollable").css('width',scrollable_width);
   			$("#img_desc").css("height",img_prev_height);
   			
   			
   			*/
  
		
	
   			
   			
   			
   			
   			$("#wrapper_td").css('width',875);
   			$("#featured").css("overflow","visible");
   			$("#body").css("overflow","auto");
   		
   			   		} else
   					{
  									
		   					if(OSName == "Windows")
									{
   										$("#title_td").css('width',"876");
   										$("#wrapper_td").css('width',900);   	
			   					} else
   										{
					   							$("#title_td").css('width',"914");
					   							$("#wrapper_td").css('width',900);   	
   								
								
   											}
   					
   				
   					$("#featured_outer").css('width',895);
   					$("#featured").css('width',877);
   					
   					//image_wrap_img
   					
   					
   					
   			}
 
 	 
   	//$("#elementToResize").css('height',(h < 1024 || w < 768) ? 500 : 400);
	session.location.href='includes/sessionframe.php?process=1&width=' + w + '&height=' + h;
//	set_corners();
	//$('#featured').corner();
}




function set_corners()
{
	Nifty("#featured_outer","top  fixed transparent");
	Nifty("#featured"," small fixed transparent");
						
	//Nifty("td#title_td","fixed-height");		
	//Nifty("div#featured_outer","fixed-height");
	//Nifty("td#wrapper_td","fixed-height");
	//Nifty("div#page_bar_outer","fixed-height");

}


function urlencode (str) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: AJ
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: travc
    // +      input by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Lars Fischer
    // +      input by: Ratheous
    // +      reimplemented by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Joris
    // +      reimplemented by: Brett Zamir (http://brett-zamir.me)
    // %          note 1: This reflects PHP 5.3/6.0+ behavior
    // %        note 2: Please be aware that this function expects to encode into UTF-8 encoded strings, as found on
    // %        note 2: pages served as UTF-8
    // *     example 1: urlencode('Kevin van Zonneveld!');
    // *     returns 1: 'Kevin+van+Zonneveld%21'
    // *     example 2: urlencode('http://kevin.vanzonneveld.net/');
    // *     returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F'
    // *     example 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a');
    // *     returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a'

    str = (str+'').toString();
    
    // Tilde should be allowed unescaped in future versions of PHP (as reflected below), but if you want to reflect current
    // PHP behavior, you would need to add ".replace(/~/g, '%7E');" to the following.
    return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').
                                                                    replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
}


function PrintThisPage() 
	{ 
  	 //var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      // sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 
   	//var sWinHTML = document.getElementById('featured').innerHTML;    
   	//var winprint=window.open("","",sOption); 
     //  winprint.document.open(); 
      // winprint.document.write('<html><link rel="STYLESHEET" type="text/css" href="/stylesmall.css"><body onload=window.print()>'); 
      // winprint.document.write(sWinHTML);          
      // winprint.document.write('</body></html>'); 
      // winprint.document.close(); 
      // winprint.focus(); 
      $("#featured").css('overflow-y','visible');
      $("#featured").css('overflow-x','visible');
      window.print();
      $("#featured").css('overflow-y','auto');
      $("#featured").css('overflow-x','hidden');
      
      
}
