var switchSize = 1024;


document.writeln("<style type=\"text/css\">\n");
// define styles that can only be used for last generation browser
if (w3c || ie4)
{
	document.writeln(".textinput { font-size: 11px; background-color: #ffffff; color: #003366; border-width: 1px; border-style: solid; border-color: #647c8c; height: 17px; padding-left: 2px; }\n");
}
else
{
	document.writeln(".textinput { font-size: 11px; background-color: #ffffff; color: #003366; height: 17px; padding-left: 2px; }\n");
}
document.writeln("</style>\n");

function UBS_getBrowserWidth()
{
	var outerWidth = (document.all) ? document.body.clientWidth + 28 : window.outerWidth;
	return outerWidth;
}


function UBS_getBrowserWidth12() {
	
	 alert("coming here");

	function getBrowserName() {
	 var browserName = navigator.appName;
	 var browserVer = parseInt(navigator.appVersion);
	 if (browserName == "Netscape"){
	   var ver = "NN";
	 } else if (browserName == "Microsoft Internet Explorer"){
	   var ver = "IE";	
	 }
	 return ver; 
        }
	
	browserNm = getBrowserName();
	
	if (browserNm == "NN") {
	  var switchSizeBody = 1024;
	  var browserWidth = (document.all) ? document.body.clientWidth + 28 : window.outerWidth;
	  //alert("browserWidth is " + browserWidth);
	} else {
	  var switchSizeBody = 1024;
	  var browserWidth = window.top.document.body.scrollWidth + 28;
	  alert("browserWidth is vvv" + browserWidth);
  	  return browserWidth;
       }	  
}



function UBS_getContentWidth( type )
{
	var contentWidth;
	var browserWidth = UBS_getBrowserWidth();
	//alert("browserWidth is " + browserWidth);

	if (browserWidth >= switchSize)
	{
		switch( type )
		{
			case "homepage": contentWidth = 726; break;
			case "homeleft": contentWidth = 265; break; // 252+13
			case "homemiddle": contentWidth = 259; break; // 246+13
			case "rightfeature": contentWidth = 526; break; //with left nav, mid, right box
			case "rightfeaturemiddle": contentWidth = 291; break; //with left nav, mid, right box. ONLY FOR TOP IMAGES
			case "rightfeatureworbox": contentWidth = 651; break; //with left nav, mid
			
			default: contentWidth = 648;
		}
	}
	else
	{
		switch( type )
		{
			case "homepage": contentWidth = 585; break;
			case "homeleft": contentWidth = 159; break; // 146+13
			case "homemiddle": contentWidth = 224; break; // 211+13
			case "rightfeature": contentWidth = 385; break; //with left nav, mid, right box
			case "rightfeaturemiddle": contentWidth = 150; break; //with left nav, mid, right box. ONLY FOR TOP IMAGES
			case "rightfeatureworbox": contentWidth = 510; break; //with left nav, mid
			
			default: contentWidth = 506;
		}
	}

	return contentWidth;
}



function UBS_getContentBodyWidth( type )
{
	
	var contentWidth;
	
	function getBrowserName() {
	 var browserName = navigator.appName;
	 var browserVer = parseInt(navigator.appVersion);
	 if (browserName == "Netscape"){
	   var ver = "NN";
	 } else if (browserName == "Microsoft Internet Explorer"){
	   var ver = "IE";	
	 }
	 return ver; 
        }
	
	browserNm = getBrowserName();
	
	if (browserNm == "NN") {
	  var switchSizeBody = 1024;
	  var browserWidth = (document.all) ? document.body.clientWidth + 28 : window.outerWidth;
	  //alert("browserWidth is " + browserWidth);
	} else {
	  var switchSizeBody = 1024;
	  //alert("original " + window.top.document.body.scrollWidth);
	  var browserWidth = window.top.document.body.scrollWidth + 28;
	  //alert("browserWidth is " + browserWidth);

	}
	
		
	if (browserWidth >= switchSizeBody )
	{
		switch( type )
		{
			case "homepage": contentWidth = 726; break;
			case "homeleft": contentWidth = 265; break; // 252+13
			case "homemiddle": contentWidth = 259; break; // 246+13
			case "rightfeature": contentWidth = 526; break; //with left nav, mid, right box
			case "rightfeaturemiddle": contentWidth = 291; break; //with left nav, mid, right box. ONLY FOR TOP IMAGES
			case "rightfeatureworbox": contentWidth = 651; break; //with left nav, mid
			
			default: contentWidth = 648;
		}
	}
	else
	{
		switch( type )
		{
			case "homepage": contentWidth = 585; break;
			case "homeleft": contentWidth = 159; break; // 146+13
			case "homemiddle": contentWidth = 224; break; // 211+13
			case "rightfeature": contentWidth = 385; break; //with left nav, mid, right box
			case "rightfeaturemiddle": contentWidth = 150; break; //with left nav, mid, right box. ONLY FOR TOP IMAGES
			case "rightfeatureworbox": contentWidth = 510; break; //with left nav, mid
			
			default: contentWidth = 506;
		}
	}

	return contentWidth;
}



function UBS_getBackgroundImage( type, image )
{
	var width = UBS_getContentWidth( type );
	return "<img src=\"/images/bg_"+image+"_"+width+"x1.gif\" width=\""+width+"\" height=\"1\" border=\"0\">";
}

function UBS_getContentImage( type )
{
	return "<img src=\"/images/1px_trans.gif\" width=\""+UBS_getContentWidth( type )+"\" height=\"1\" border=\"0\">";
}

function UBS_getContentBodyImage( type )
{
	return "<img src=\"/images/1px_trans.gif\" width=\""+UBS_getContentBodyWidth( type )+"\" height=\"1\" border=\"0\">";
}


function UBS_getContentTable( type )
{
	return "<table width=\""+UBS_getContentWidth( type )+"\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
}
