// List of functions

//1. Trim - fnTrim(a_strString)
//2. Check null - fnIsNull(a_strString)
//3. Compare 2 Strings - fnCompareStrings(a_strString1, a_strString2)
//4. Check for Special characters - fnContainsSpecialChars(a_strString)
//5. Validate Password - fnIsValidPassword(a_strString)
//6. Check for valid name - fnIsValidName(a_strString)
//7. Is Valid email - fnIsEmail(a_strString)
//8. Is Valid date - fnIsValidDate(a_strDate)
//9. Compare dates - fnCompareDates( a_strDate1, a_strDate2)
//10. IsValidUrl - fnIsValidUrl(a_strString)
//11. IsPositiveNumber - fnIsPositiveNumber(a_strString)) 
//12. Check for valid description - fnIsValidDesc(a_strString)
//13. Pop up window for searching  - fnSearch(a_strKeyword)
//14. Assignment - fnMoveSelected(fromThisListBox,toThisListBox)
//15. Assignment of all - fnMoveAll(fromThisListBox,toThisListBox)
//16. Check Address -  fnIsValidAddress(a_strStreetAddress,a_strCity,a_strState,a_strCountry,a_strZip)
//17. Check for embeded space character - fnContainsSpace(a_strString)
//18. Help function for Client Admin- show_popup_window_help()
//19. Help function for learner- show_popup_window_learner_help ()
//20. Help function System Admin- show_popup_window_Admin_help ()
//21. IsValidPhoneFax - fnIsValidPhoneFax(a_strString)) 
//The following function  is added by the Bangalore team(Version 1.5)
//22. To check the whether the check box is selected or not? isCheckboxChecked(who) 

//---------------------------------------------------------------------------------------------------

var NULL_FIELD = "Field cannot be blank"
var SPECIAL_CHARS = "Field cannot contain special characters"
var INVALID_PASSWORD = "Password cannot contain ' ? & \\ characters"
var INVALID_NAME = "Field cannot contain special characters"
var INVALID_DATE = "Invalid date"
var INVALID_URL = "Field contains an invalid URL"
var NOT_POSITIVE_NUM = "Field should contain a positive number"
var INVALID_DESC = "Field cannot contain special characters"
var INVALID_CONFIRM_PASSWORD = "Confirm Password is different from the new password"
var VALID_URL="www.primelearning.com"
var VALID_PHONE_FAX="(508) 616 7000"
var VALID_EMAIL="john.doe@company.com"
var INVALID_DESC_SPECIAL_CHARACTER="\n % ^ & + ? < > = \\ \""
var INVALID_PHONE_FAX_SPECIAL_CHARACTER="\n % ^ & + ? < > = , _ \\ \" "

// Trims the input string of leading and trailing spaces and returns the new string

function fnTrim(a_strString2)
{
	var cnt;
//	alert("fnTrim " + a_strString2);
	len = a_strString2.length;
	str = a_strString2;
	begin = -1;
	for(cnt=0;cnt<len;cnt++)
	{
		if (str.charAt(cnt) == " ")
		{	
			begin = cnt;
		}	
		else
		break;
	}
	str = str.slice(begin+1,len);
	len = str.length;
	end = len;
	for(cnt=len-1;cnt>=0;cnt--)
	{
		if (str.charAt(cnt) == " ")
		{	
			end = cnt;
		}	
		else
		break;
	}
	str = str.slice(0,end);
return str;
}


//---------------------------------------------------------------------------------------------------

// Checks if the input string is null or blanks


function fnIsNull(a_strString)
{
//	alert("fnIsNull ?" + a_strString);
       if (fnTrim(a_strString) == null || fnTrim(a_strString) == "" )
       {
        return true;
       }

	return false;

}


//---------------------------------------------------------------------------------------------------

// Compares the 2 passed strings. Returns true if they are equal. Ignores the leading and trailing spaces.

function fnCompareStrings(a_strString1, a_strString2)
{
       if (fnTrim(a_strString1) != fnTrim(a_strString2))
           return false;
	 return true;
}


//---------------------------------------------------------------------------------------------------

// Checks for special characters. Can be used for Login Id check

function fnContainsSpecialChars(a_strString)
{    
    a_strString = fnTrim(a_strString);     
    if(a_strString.indexOf("`") != -1)
      return true;
    if(a_strString.indexOf("~") != -1)
      return true;
    if(a_strString.indexOf("!") != -1)
       return true;
//    if(a_strString.indexOf("@") != -1)
//       return true;
    if(a_strString.indexOf("#") != -1)
       return true;
    if(a_strString.indexOf("$") != -1)
       return true;
    if(a_strString.indexOf("%") != -1)
      return true;
    if(a_strString.indexOf("^") != -1)
       return true;
    if(a_strString.indexOf("&") != -1)
       return true;
    if(a_strString.indexOf("*") != -1)
       return true;
//    if(a_strString.indexOf("-") != -1)
//       return true;
//    if(a_strString.indexOf("_") != -1)
//       return true;
    if(a_strString.indexOf("+") != -1)
       return true;
    if(a_strString.indexOf("=") != -1)
       return true;
    if(a_strString.indexOf("|") != -1)
       return true;
    if(a_strString.indexOf("\\") != -1)
       return true;
    if(a_strString.indexOf("}") != -1)
       return true;
    if(a_strString.indexOf("]") != -1)
       return true;
    if(a_strString.indexOf("{") != -1)
       return true;
    if(a_strString.indexOf("[") != -1)
       return true;
    if(a_strString.indexOf("\"") != -1)
       return true;
    if(a_strString.indexOf(":") != -1)
       return true;
    if(a_strString.indexOf(";") != -1)
       return true;
    if(a_strString.indexOf("?") != -1)
       return true;
    if(a_strString.indexOf(">") != -1)
       return true;
    if(a_strString.indexOf("<") != -1)
       return true;
    if(a_strString.indexOf("(") != -1)
       return true;
    if(a_strString.indexOf(")") != -1)
       return true;
    if(a_strString.indexOf(",") != -1)
       return true;
    if(a_strString.indexOf("'") != -1)
       return true;
//    if(a_strString.indexOf(".") != -1)
//       return true;
    if(a_strString.indexOf("/") != -1)
       return true;

    return false;
}


//---------------------------------------------------------------------------------------------------

// Validates the Password string

function fnIsValidPassword(a_strString)
{
  a_strString = fnTrim(a_strString); 
 if(a_strString.indexOf(" ") != -1)
     return false; 
  if(a_strString.indexOf("'") != -1)
     return false;
  if(a_strString.indexOf("\"") != -1)
     return false;
  if(a_strString.indexOf("?") != -1)
       return false;
  if(a_strString.indexOf("&") != -1)
       return false;

  return true;

}


//---------------------------------------------------------------------------------------------------

// Validates if the string is a valid name. Will be used for validation of Company, Curriculum and course names

function fnIsValidName(a_strStr)
{
	//alert("in fnIsValidName" + a_strStr );
//	alert("working in CommFunstions.js");
    var a_strString1 = fnTrim(a_strStr);   
    if(a_strString1.indexOf("`") != -1)
      return false;
    if(a_strString1.indexOf("~") != -1)
      return false;
    if(a_strString1.indexOf("!") != -1)
       return false;
    if(a_strString1.indexOf("@") != -1)
       return false;
    if(a_strString1.indexOf("#") != -1)
       return false;
    if(a_strString1.indexOf("$") != -1)
       return false;
    if(a_strString1.indexOf("%") != -1)
      return false;
    if(a_strString1.indexOf("^") != -1)
       return false;
    if(a_strString1.indexOf("&") != -1)
       return false;
    if(a_strString1.indexOf("*") != -1)
       return false;
    if(a_strString1.indexOf("(") != -1)
       return false;
    if(a_strString1.indexOf(")") != -1)
       return false;
    if(a_strString1.indexOf("+") != -1)
       return false;
    if(a_strString1.indexOf("=") != -1)
       return false;
    if(a_strString1.indexOf("|") != -1)
       return false;
    if(a_strString1.indexOf("\\") != -1)
       return false;
    if(a_strString1.indexOf("}") != -1)
       return false;
    if(a_strString1.indexOf("]") != -1)
       return false;
    if(a_strString1.indexOf("{") != -1)
       return false;
    if(a_strString1.indexOf("[") != -1)
       return false;
    if(a_strString1.indexOf("\"") != -1)
       return false;
    if(a_strString1.indexOf(":") != -1)
       return false;
    if(a_strString1.indexOf(";") != -1)
       return false;
    if(a_strString1.indexOf("/") != -1)
       return false;
    if(a_strString1.indexOf("?") != -1)
       return false;
    if(a_strString1.indexOf(">") != -1)
       return false;
    if(a_strString1.indexOf("<") != -1)
       return false;

    return true;
}

//---------------------------------------------------------------------------------------------------

// Validates if the string is a valid name. Will be used for validation of Company, Curriculum and course names

function fnIsValidCompanyName(a_strString)
{
    var a_strString = fnTrim(a_strString );   
    if(a_strString.indexOf("`") != -1)
      return false;
    if(a_strString.indexOf("~") != -1)
      return false;
    if(a_strString.indexOf("!") != -1)
       return false;
    if(a_strString.indexOf("@") != -1)
       return false;
    if(a_strString.indexOf("#") != -1)
       return false;
    if(a_strString.indexOf("$") != -1)
       return false;
    if(a_strString.indexOf("%") != -1)
      return false;
    if(a_strString.indexOf("^") != -1)
       return false;
    if(a_strString.indexOf("*") != -1)
       return false;
    if(a_strString.indexOf("(") != -1)
       return false;
    if(a_strString.indexOf(")") != -1)
       return false;
    if(a_strString.indexOf("+") != -1)
       return false;
    if(a_strString.indexOf("=") != -1)
       return false;
    if(a_strString.indexOf("|") != -1)
       return false;
    if(a_strString.indexOf("\\") != -1)
       return false;
    if(a_strString.indexOf("}") != -1)
       return false;
    if(a_strString.indexOf("]") != -1)
       return false;
    if(a_strString.indexOf("{") != -1)
       return false;
    if(a_strString.indexOf("[") != -1)
       return false;
    if(a_strString.indexOf("\"") != -1)
       return false;
    if(a_strString.indexOf(":") != -1)
       return false;
    if(a_strString.indexOf(";") != -1)
       return false;
    if(a_strString.indexOf("/") != -1)
       return false;
    if(a_strString.indexOf("?") != -1)
       return false;
    if(a_strString.indexOf(">") != -1)
       return false;
    if(a_strString.indexOf("<") != -1)
       return false;

    return true;
}
//---------------------------------------------------------------------------------------------------

// Validates if the passed string is a valid email id

function fnIsEmail(a_strString)
{
    if (a_strString.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
    {
       return true;
    }

    return false;
}


//---------------------------------------------------------------------------------------------------

// Checks if the passed date is a valid date. Expects date in mm/dd/yyyy format


function fnIsValidDate(a_strDate){
	
	var a_strDate = a_strDate.split("/");
	a_strMonth = a_strDate[0];
	a_strDay = a_strDate[1];
	a_strYear = a_strDate[2];



	if ( ( isNaN( a_strYear ) ) || ( isNaN( a_strMonth ) ) || ( isNaN( a_strDay ) ) )	{
		return false;
	}
	else {
		if (  ( a_strYear < 1900 ) || ( a_strYear > 2079 ) || ( a_strMonth > 12 ) || ( a_strMonth<1 ) || ( a_strDay < 1 ) || ( a_strDay > 31 ) || ( ( ( a_strMonth == 4 ) || ( a_strMonth == 6 ) || ( a_strMonth == 9 ) || (  a_strMonth == 11 ) ) && ( a_strDay > 30 ) ) )  
			return false;
		else {
			if ( ( a_strYear % 4 == 0 ) && ( ( a_strYear % 100 != 0 ) || ( a_strYear % 400 == 0 ) ) )	{
				if ( ( a_strMonth == 2 ) && ( ( a_strDay > 29 ) || ( a_strDay < 1 ) ) ) {
					return false;
				}
			}
			else {
				if ( ( a_strMonth == 2 ) && ( ( a_strDay > 28 ) || ( a_strDay < 1 ) ) ) {
					return false;
				}
			}
		} // end of else
	}//end of else
	return true;
}


//---------------------------------------------------------------------------------------------------

// Checks if the passed date1 is greater than date2. Expects the dates in the mm/dd/yyyy format

function fnCompareDates(a_strDate1, a_strDate2) {

	var a_strMonth1;
	var a_strDay1;
	var a_strYear1;
	var a_strMonth2;
	var a_strDay2;
	var a_strYear2;

	var blFlag = true;
	
			var arrDate1 = a_strDate1.split("/");
			var arrDate2 = a_strDate2.split("/");
			a_strMonth1 = arrDate1[0];
			a_strDay1 = arrDate1[1];
			a_strYear1 = arrDate1[2];
			a_strMonth2 = arrDate2[0];
			a_strDay2 = arrDate2[1];
			a_strYear2 = arrDate2[2];

			
	if (parseInt(a_strYear1, 10) > parseInt(a_strYear2, 10))
		return false;
	else
		if ((parseInt(a_strMonth1, 10) > parseInt(a_strMonth2, 10)) && (parseInt(a_strYear1, 10) == parseInt(a_strYear2, 10)))
			return false;
		else
			if ((parseInt(a_strDay1, 10) > parseInt(a_strDay2, 10)) 
				&& (parseInt(a_strYear1, 10) == parseInt(a_strYear2, 10))
				&& (parseInt(a_strMonth1, 10) == parseInt(a_strMonth2, 10)))
				return false;

	return true;
}

//---------------------------------------------------------------------------------------------------

// Checks if the passed string is a valid URL


function fnIsValidUrl(a_strString)
{

   var a_strString = fnTrim(a_strString);
    if(a_strString.indexOf(" ") != -1)
      return false;    
    if(a_strString.indexOf("`") != -1)
      return false;
    if(a_strString.indexOf("~") != -1)
      return false;
    if(a_strString.indexOf("!") != -1)
       return false;
    if(a_strString.indexOf("@") != -1)
       return false;
    if(a_strString.indexOf("#") != -1)
       return false;
    if(a_strString.indexOf("$") != -1)
       return false;
    if(a_strString.indexOf("%") != -1)
      return false;
    if(a_strString.indexOf("^") != -1)
       return false;
    if(a_strString.indexOf("&") != -1)
       return false;
    if(a_strString.indexOf("+") != -1)
       return false;
    if(a_strString.indexOf("=") != -1)
       return false;
    if(a_strString.indexOf("|") != -1)
       return false;
    if(a_strString.indexOf("\\") != -1)
       return false;
    if(a_strString.indexOf("}") != -1)
       return false;
    if(a_strString.indexOf("]") != -1)
       return false;
    if(a_strString.indexOf("{") != -1)
       return false;
    if(a_strString.indexOf("[") != -1)
       return false;
    if(a_strString.indexOf("\"") != -1)
       return false;
    if(a_strString.indexOf(":") != -1)
       return false;
    if(a_strString.indexOf(";") != -1)
       return false;
    if(a_strString.indexOf("?") != -1)
       return false;
    if(a_strString.indexOf(">") != -1)
       return false;
    if(a_strString.indexOf("<") != -1)
       return false;
    if(a_strString.indexOf("(") != -1)
       return false;
    if(a_strString.indexOf(")") != -1)
       return false;
    if(a_strString.indexOf("'") != -1)
       return false;
  
    return true;	
}


//---------------------------------------------------------------------------------------------------

// Checks if the passed string is a positive number


function fnIsPositiveNumber(a_strString) {

	if(( isNaN(a_strString) ) || ( a_strString.indexOf( " " ) != -1 ) || ( a_strString.indexOf(".") != -1 )) 
		return false;
	// Number should be >= 0
	else if (a_strString < 0 ) 
		return false;
	else 
		return true; 
}


//---------------------------------------------------------------------------------------------------

// Validates if the string is a valid description. Will be used for validation of descriptive fields

function fnIsValidDesc(a_strString)
{
    var a_strString = fnTrim(a_strString );   
    if(a_strString.indexOf("%") != -1)
      return false;
    if(a_strString.indexOf("^") != -1)
       return false;
    if(a_strString.indexOf("&") != -1)
       return false;
    if(a_strString.indexOf("+") != -1)
       return false;
    if(a_strString.indexOf("=") != -1)
       return false;
    if(a_strString.indexOf("\\") != -1)
       return false;
    if(a_strString.indexOf("\"") != -1)
       return false;
    if(a_strString.indexOf("?") != -1)
       return false;
    if(a_strString.indexOf(">") != -1)
       return false;
    if(a_strString.indexOf("<") != -1)
       return false;

    return true;
}


//---------------------------------------------------------------------------------------------------

// Validates if the string is a valid description. Will be used for validation of descriptive fields

function fnIsValidNewsText(a_strString)
{
    var a_strString = fnTrim(a_strString );   
    if(a_strString.indexOf("%") != -1)
      return false;
    if(a_strString.indexOf("^") != -1)
       return false;
    if(a_strString.indexOf("+") != -1)
       return false;
    if(a_strString.indexOf("=") != -1)
       return false;
    if(a_strString.indexOf("\\") != -1)
       return false;
    if(a_strString.indexOf("\"") != -1)
       return false;
    if(a_strString.indexOf(">") != -1)
       return false;
    if(a_strString.indexOf("<") != -1)
       return false;

    return true;
}
//---------------------------------------------------------------------------------------------------

// This function is called whenever search is invoked from any page. 


function fnSearch(a_strKeyword,a_strType)
{
    var winSearch = null;
    if(a_strKeyword.indexOf("\"") == -1)
    {
        if(a_strType == "search")
        {
            if((!fnIsNull(document.frmSearch.txtSearchWord.value)) && document.frmSearch.txtSearchWord.value.length >1)
            {
                winSearch = window.open ("PrimeSearch.jsp?keywords="+escape(a_strKeyword)+"&type="+a_strType, "popup3", "toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=800,height=500");
                winSearch.focus();
            }
            else
                alert("Invalid search keyword");
        }
        else
        {
            winSearch = window.open ("PrimeAdvancedSearch.jsp?keywords="+escape(a_strKeyword)+"&type="+a_strType, "popup3", "toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=800,height=500");
    	      winSearch.focus();
        }
    }
    else
        alert("\" not allowed in search");
}



//---------------------------------------------------------------------------------------------------

// This function is used for List Box drag and drop

function fnMoveSelected(fromThisListBox,toThisListBox)
  {
	  var iCount;
	  var Courseexists;
	  var inextCourse;
	  for (iCount = 1; iCount < fromThisListBox.options.length; iCount++)
      {
		    if (fromThisListBox.options[iCount].selected)
          {
      	    inextCourse = toThisListBox.options.length;
				    toThisListBox.options[inextCourse] = new Option(fromThisListBox.options[iCount].text);
				    toThisListBox.options[inextCourse].value = fromThisListBox.options[iCount].value;
	        }
	    }
    for (iCount = 1; iCount < fromThisListBox.options.length; iCount++)
      {
        if (fromThisListBox.options[iCount].selected)
          {
            //fromThisListBox.remove(iCount);
            fromThisListBox.options[iCount] = null;
            iCount=iCount-1;
          }
      }
  }


//---------------------------------------------------------------------------------------------------

// This function is used for List Box drag and drop ALL

function fnMoveAll(fromThisListBox,toThisListBox)
  {
	  var iCount;
	  var Courseexists;
	  var inextCourse;
	  for (iCount = 1; iCount < fromThisListBox.options.length; iCount++)
      {
				inextCourse = toThisListBox.options.length;
				toThisListBox.options[inextCourse] = new Option(fromThisListBox.options[iCount].text);
				toThisListBox.options[inextCourse].value = fromThisListBox.options[iCount].value;
	    }
    for (iCount = 1; iCount < fromThisListBox.options.length; iCount++)
      {
        fromThisListBox.options[iCount] = null;
        //fromThisListBox.remove(iCount);
        iCount=iCount-1;
      }
  }
function fnIsValidAddress(a_strStreetAddress,a_strCity,a_strState,a_strCountry,a_strZip)
	{

		var a_strStreetAddress = fnTrim(a_strStreetAddress);
 		var a_strCity = fnTrim(a_strCity);
		var a_strState = fnTrim(a_strState);
		var a_strCountry = fnTrim(a_strCountry);
		var a_strZip = fnTrim(a_strZip);
		if (( a_strStreetAddress != "") || (a_strCity != "") || (a_strState != "") || (a_strCountry != "") || (a_strZip != ""))
			    	
			{ 
				if (( a_strStreetAddress == "") || ( a_strCity == "") || (a_strState == "")  || (a_strCountry == "") || (a_strZip == "")) 
				{
					    
					    return false;
				}
					    
						return true;
			}
			return true;

	}

//---------------------------------------------------------------------------------------------------

// This function checks whether the string contains any embeded space character
function fnContainsSpace(a_strString)
{
    var a_strString = fnTrim(a_strString ); 
	
    // Space character  
    if(a_strString.indexOf(" ") != -1)
      return true;
    

    return false;
}



//---------------------------------------------------------------------------------------------------

 function show_popup_window_help ()
{
window.open ("/Help/ClientAdmin/WebHelp/PrimeClientAdminHelp.htm", "popup6", "width=550,height=600,scrollbar=yes,resizable=yes");
}


//---------------------------------------------------------------------------------------------------

function show_popup_window_learner_help ()
{
window.open ("/Help/Learner/WebHelp/PrimeLearnerHelp.htm", "popup6", "width=700,height=500,scrollbar=yes,resizable=yes");
}


//---------------------------------------------------------------------------------------------------

function show_popup_window_Admin_help ()
{
window.open ("/Help/Admin/WebHelp/PrimeAdminHelp.htm", "popup6", "width=700,height=500,scrollbar=yes,resizable=yes");
}

//---------------------------------------------------------------------------------------------------



// Validates if the string is a valid Phone or Fax.
function fnIsValidPhoneFax(a_strString)
{
//Release 1.5(To allow the User to enter any character as the phone number
//Modified by the Bangalore Team on 29/03/01)

 /*   var a_strString = fnTrim(a_strString );
    if(a_strString.indexOf("'") != -1)
      return false;
    if(a_strString.indexOf("`") != -1)
      return false;
    if(a_strString.indexOf("~") != -1)
      return false;
    if(a_strString.indexOf("!") != -1)
       return false;
    if(a_strString.indexOf("@") != -1)
       return false;
    if(a_strString.indexOf("#") != -1)
       return false;
    if(a_strString.indexOf("$") != -1)
       return false;
    if(a_strString.indexOf("%") != -1)
      return false;
    if(a_strString.indexOf("^") != -1)
       return false;
    if(a_strString.indexOf("&") != -1)
       return false;
    if(a_strString.indexOf("*") != -1)
       return false;
    if(a_strString.indexOf("+") != -1)
       return false;
    if(a_strString.indexOf("_") != -1)
      return false;
    if(a_strString.indexOf("=") != -1)
       return false;
    if(a_strString.indexOf("|") != -1)
       return false;
    if(a_strString.indexOf("\\") != -1)
       return false;
    if(a_strString.indexOf("}") != -1)
       return false;
    if(a_strString.indexOf("]") != -1)
       return false;
    if(a_strString.indexOf("{") != -1)
       return false;
    if(a_strString.indexOf("[") != -1)
       return false;
    if(a_strString.indexOf("\"") != -1)
       return false;
    if(a_strString.indexOf(";") != -1)
       return false;
    if(a_strString.indexOf("?") != -1)
       return false;
    if(a_strString.indexOf(">") != -1)
       return false;
    if(a_strString.indexOf("<") != -1)
       return false;
    if(a_strString.indexOf(",") != -1)
      return false;
*/
    return true;
}

//Bangalore team added the following function (Version 1.5) as per the Scalable UI.

function isCheckboxChecked(who){
	var checkBoxChecked=false;
	for (i=0;i<document.forms[0].elements.length;i++){
		if (document.forms[0].elements[i].type=="checkbox"){
			if(document.forms[0].elements[i].checked==true){
				checkBoxChecked=true;
				break;
			}
		}
	}	
	if(!checkBoxChecked){
		alert("Please select atleast one "+ who);
		return false;
	}else{
		return true;
	}
}

//Format the currency value for E-store

function formatCurrency(str) {
	str = str.toString();
	index = str.indexOf(".");
	if (index < 0) str = str + ".00";
	else {
		strCent = str.substring(index,str.length );
		if (strCent.length < 3) str += "0";
	}
	return str;
}

//Open a new for the main navigation bar 
function openMainWin(url3)
{
	features2='resizable,toolbar,status,width=790,height=590,scrollbars,location';
    	aleft=80; atop=80;
    	features2=features2+',left='+aleft+',top='+atop;
   	window.open(url3,"",features2,true);
}

//Open a new popup Window 
function openDescWin(url2)
{
	features1='width=790,height=590,scrollbars,resizable';
    	aleft=80; atop=80;
    	features1=features1+',left='+aleft+',top='+atop;
   	window.open(url2,"",features1,true);

//	urlStr = "/estore/frame1.htm?Link="+url;
//   	window.open(urlStr,"",features,true);
}

//Open a new popup window
function openWin(url1)
{
	features='resizable,width=550,height=450,scrollbars';
    	aleft=80; atop=80;
    	features=features+',left='+aleft+',top='+atop;
   	window.open(url1,"",features,true);
}

//Open popup Window to print
function openPrintWin(actn,param,curr)
{
	features='width=750,height=450,scrollbars,resizable';
	aleft = ((screen.width / 2) - (750 / 2) - 6);
	atop = ((screen.height / 2) - (450 / 2) - 25);
	if (navigator.appName=='Netscape')
	{
		features += ", screenX = " + aleft + ", screenY = " + atop;
	}
	else
	{
		features += ", left = " + aleft + ", top = " + atop;
	}

	urlStr = "/estore/PLEStoreSer.ser?SubmitButton="+actn+"&PageToPrint="+param+"&CURRENCY="+curr;
    	window.open(urlStr,"",features,true);
}


// Submit the form to the required routine
function goPost(frm,paramValue,actn)
{
	frm.method="post";
	frm.SubmitButton.value= paramValue;
	frm.action=actn;
	frm.submit();
}


// Print the whole page to the printer
function printPage() 
{
	if (window.print)
	    window.print();
	else
	    alert("Sorry, your browser doesn't support this feature.");
}


