//  Application:   SQPS_v02_02_03 - portal implementation
//	common.jsp - common javascript functions 


// JavaScript Document
		function openWindow(url) {
			var strFeatures = "resizable,width=500,height=570,location=off,menubar=off,scrollbars,toolbar=off,";
			
			if (document.all) {
				strFeatures += "left=100,top=50";
			} else {
				strFeatures += "screenX=100,screenY=50";
			}
			dwin=window.open(url,"help",strFeatures);
			dwin.focus();
		}

		function openFeedback(url) {
			var strFeatures = "resizable,width=500,height=570,location=off,menubar=off,scrollbars,toolbar=off,";
			
			if (document.all) {
				strFeatures += "left=100,top=50";
			} else {
				strFeatures += "screenX=100,screenY=50";
			}
			dwin=window.open(url,"Feedback",strFeatures);
			dwin.focus();
		}

		function openTracking(url) {
			var strFeatures = "resizable,width=700,height=480,location=off,menubar=off,scrollbars,toolbar,";
			if (document.all) {
				strFeatures += "left=100,top=50";
			} else {
				strFeatures += "screenX=100,screenY=50";
			}
			dwin=window.open(url,"tracking",strFeatures);
			dwin.focus();
		}

		function openPrint(url) {
			var strFeatures = "resizable,width=600,height=570,location=off,menubar,scrollbars,toolbar=off,";
			
			if (document.all) {
				strFeatures += "left=100,top=50";
			} else {
				strFeatures += "screenX=100,screenY=50";
			}
			dwin=window.open(url,"print",strFeatures);
			dwin.focus();
		}

// verify compare products on view list from
function verifyForm( form, max_number, one_item_text, max_item_text )
{
	var iChecked = 0 ;
	if (!form.ITEMLIST.length)
	{
		if (!form.ITEMLIST.checked) 
		{
			alert( one_item_text) ;
			return false;
		} else {
			//return true;
			form.submit();
		}
	} else {
			for( var i = 0 ; i < form.ITEMLIST.length ; i++ )
			{
				if( form.ITEMLIST[i].checked )
					iChecked++ ;
			
				if( iChecked > max_number )
				{
					alert( max_item_text + " " + max_number  ) ;
					return false ;
				}
			}
			if( iChecked < 1 )
			{
				alert( one_item_text ) ;
				return false ;
			}	
			//return true ;
			form.submit();
	}
}

// verify keyword search string for minimum number of characters in string
function CheckData(form,error_msg, minchar)

{
      var strAlertMessage = error_msg;

i=0;
	var string = form.SRCH.value;
	// remove the wildcard character before checking for minimum length
	string = string.replace(/\*/g,'');
	//form.SRCH.value = string
	if (string.length < minchar)
	{	
		alert(strAlertMessage);
		return false;
	}
	else 
	{
		return true;
	}
}

// reload frame if text size is changed in the browser
var defaultfontsize = 0
function getFontSize() {
	if (document.defaultView && document.defaultView.getComputedStyle) {
		return parseInt(document.defaultView.getComputedStyle(document.body,'').getPropertyValue("font-size"))
	}
	else if (document.all && document.body.currentStyle) {

		return parseInt(document.body.currentStyle.fontSize)
	}
}
function check() {
	var currentsize = getFontSize()

	if (currentsize != defaultfontsize) {
		//alert ("fontsize change default=" + defaultfontsize + "current size= " + currentsize)
	
	window.document.location.reload(false);
	//document.location.reload();
	}
	defaultfontsize = currentsize

}
function checkfontsize() {
	var theInterval = 500
	if ((document.defaultView && document.defaultView.getComputedStyle) || (document.all && document.body.currentStyle)) {
		defaultfontsize = getFontSize()
		// only do font checking on production servers
		if (document.location.hostname != 'dallas02'){
			setInterval("check()",theInterval)
		}
	}
//	else {
//		alert ("document.defaultView and document.body.currentStyle are not supported")
//	}
}





