/**
 * Window Reziser
 * @author netTrek - Saban Uenlue
 */


// JavaScript Document
function getWinInnerWidth () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.clientWidth) {
    return document.body.clientWidth;
  } else if (document.documentElement && document.documentElement.clientWidth) {
    return document.documentElement.clientWidth;
  } else {
    return 0;
  }
}

function getWinInnerHeight () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.clientHeight) {
    return document.body.clientHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) {
    return document.documentElement.clientHeight;
  } else {
    return 0;
  }
}

function setWindowSize ( sw, sh ) 
{
	//alert ( sw +"x" + sh );
	if ( typeof (getWinInnerWidth) == 'function' && typeof (getWinInnerHeight) == 'function')
	{
		try
		{
			//alert ( sw +"x" + sh );
			var w = getWinInnerWidth ();
			var h = getWinInnerHeight ();
			//alert ( w +"x" + h );
			if ( w > 0 && h > 0 )
			{
				if ( w != sw && h != sh )
					window.resizeBy( sw - w, sh - h );
				else if ( w != sw )
					window.resizeBy( sw - w, 0 );
				else if ( h != sh )
					window.resizeBy( 0, sh - h );
			}
		}
		catch ( exception ) {
		}
	}
}
