function openWin(wName, wWidth, wHeight, wResize)
{

	var features = 'scrollbars=1,status=1,resizable=1';

	//var popWin = window.open("/modules/generatequote.php","HROQtnn");

//        if(popWin.focus) { popWin.focus(); }

        return true;
}




function description (package, ees)
{
	var desc = "HR and Benefit management, Attendance, Compensation, Customization, Reporting, Org Charting, Quickstart, Data Import and Export, Employee Correspondence, Applicant Tracking, Payroll Connect";

	if (package == "S")
	{
		desc += "."; 

	}
	else
	{
		desc += ", HROffice Self-Service (Myself, My Family, My Benefits, My Time-Off, My Company, My Paycheck) and HROffice Online Open Enrollment.";

	}
	
	return desc;	

}


function total (package, ees)
{
	var money = 0;

	if (package == "S")
	{
		money = totalS (ees); 

	}
	else
	{
		money = totalP (ees);

	}

	return money;
}

function totalP (ees)
{
	var money = 0;

	if (ees == "50")
	{	
		money = "6,940.00";
	} else if (ees == "100")
	{	
		money = "12,070.00";
	} else if (ees == "150")
	{	
		money = "15,360.00";
	} 

	return money ;

}


function totalS (ees)
{
	var money = 0;

	if (ees == "50")
	{	
		money = "4,250.00";
	} else if (ees == "100")
	{	
		money = "6,710.00";
	} else if (ees == "150")
	{	
		money = "9,020.00";
	} 

	return money ;

}

function nextYearCostS (ees)
{
	var money = 0;

	if (ees == "50")
	{	
		money = "630.00";
	} else if (ees == "100")
	{	
		money = "950.00";
	} else if (ees == "150")
	{	
		money = "1,330.00";
	} 

	return money ;

}

function nextYearCostP (ees)
{
	var money = 0;

	if (ees == "50")
	{	
		money = "950.00";
	} else if (ees == "100")
	{	
		money = "1,680.00";
	} else if (ees == "150")
	{	
		money = "2,350.00";
	} 

	return money ;

}

function nextYearCost (package, ees) 
{
	var money = 0;

	if (package == "S")
	{
		money = nextYearCostS (ees); 

	}
	else
	{
		money = nextYearCostP(ees);

	}

	return money;
}

function implPHours (ees) {
	var hours = 0;

	if (ees == "50")
	{	
		hours = 20;
	} else if (ees == "100")
	{	
		hours = 20;
	} else if (ees == "150")
	{	
		hours = 20;
	} 

	return hours;

}


function implSHours (ees) {
	var hours = 0;

	if (ees == "50")
	{	
		hours = 16;
	} else if (ees == "100")
	{	
		hours = 16;
	} else if (ees == "150")
	{	
		hours = 16;
	} 

	return hours;

}


function implHours (package, ees) {
	var hours = 0;

	
	if (package == "S")
	{
		hours = implSHours (ees); 
	
	}
	else if (package == "P") {
		hours = implPHours (ees);
	
	};


	return hours;
}


function trainingSHours (ees) {
	var hours = 0;

	if (ees == "50")
	{	
		hours = 4;
	} else if (ees == "100")
	{	
		hours = 4;
	} else if (ees == "150")
	{	
		hours = 4;
	} 

	return hours;
}

function trainingPHours (ees) {
	var hours = 0;

	if (ees == "50")
	{	
		hours = 6;
	} else if (ees == "100")
	{	
		hours = 6;
	} else if (ees == "150")
	{	
		hours = 6;
	} 

	return hours;
}


function trainingHours (package, ees) {
	var hours = 0;
//	alert (package + " " + ees);
	
	if (package == "S")
	{
		hours = trainingSHours (ees); 
	
	}
	else if (package == "P") {
		hours = trainingPHours (ees);
	
	};


	return hours;
}


function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function




function qs() {

var qsParam = new Array();

var query = window.location.search.substring(1);

var parms = query.split('&');

var re = new RegExp ("/%20/");
re.global = true;

var pos;
var key;
var val;

	for (var i=0; i<parms.length; i++) {
   		pos = parms[i].indexOf('=');
		if (pos > 0) {
			key = parms[i].substring(0,pos);
      			val = parms[i].substring(pos+1);
			
			while (val.indexOf("%20") >= 0)
				val = val.replace("%20"," ");

			qsParam[key] = val;
			// alert (key + "=" + val);
      		}
   	}

	return qsParam;
}




function GetDay(nDay)
{
	var Days = new Array("Sunday","Monday","Tuesday","Wednesday",
	                     "Thursday","Friday","Saturday");
	return Days[nDay]
}

function GetMonth(nMonth)
{
	var Months = new Array("January","February","March","April","May","June",
	                       "July","August","September","October","November","December");
	return Months[nMonth] 	  	 
}



function DateString()
{
	var Today = new Date();
	

	var strDate = GetMonth(Today.getMonth()) + " " + Today.getDate();
	strDate += ", " + Today.getYear();
	
	//alert(strDate);

	return strDate;
}

function DateString_NextMonth()
{


	var Today= new Date();
	var strDate = "";

	Today.setMonth (Today.getMonth() + 1);

	Today.setDate (Today.getDate () - 1);
		

	strDate = GetMonth(Today.getMonth()) + " " + Today.getDate() + ", " + Today.getYear();
	

	return strDate;

}

function isMail(_email) {
     var emailReg = /^[a-z][a-z-_0-9\.]+@[a-z-_=>0-9\.]+\.[a-z]{2,3}$/i
     return emailReg.test(_email);
}

function isInteger(str)
{ 
   if (str.length==0) return false;
   for (var i = 0; i < str.length; i++ )  { 
    var ch = str.charAt (i)  
    if (ch < "0" || ch > "9") return false;
   } 
   return true;
}


function checkForm()
{

	var name = Trim(order.name.value);
	var company = Trim(order.company.value);
	var address = Trim(order.address.value);
	var city= Trim(order.city.value);
	var state = Trim(order.state.value);
	var zip = Trim(order.zip.value);
	var country = Trim(order.country.value);
	var phone = Trim(order.phone.value);
	var email = Trim(order.email.value);
	var salutation = Trim(order.salutation.value);
	var allok=true;


         
if ((allok) && name.length <= 0){
 alert('Please enter your name');
 order.name.focus();
 allok=false;
}

if ((allok) && (company.length <= 0)){
 alert('Please fill in the "Company" field.');
 order.company.focus();
 allok=false;
}

if ((allok) && (phone.length <= 0)){
 alert('Please fill in the "Phone" field.');
 order.phone.focus();
 allok=false;
}

if ((allok) && (!isMail(email))){
 alert('Please enter a valid email address.');
 order.email.focus();
 allok=false;
}

if ((allok) && (''==address)){
 alert('Please fill in the "Address" field');
 order.address.focus();
 allok=false;
}


if ((allok) && (''==city)) {
   alert('Please fill in the "City" field.');
   order.city.focus();
   allok=false;
}

if ((allok) && (''==state)){
 alert('Please fill in the "State/Province" field.');
 order.state.focus();
 allok=false;
}
  
if ((allok) && (''==zip)){
 alert('Please fill in the "ZIP" field ');
 order.zip.focus();
 allok=false;
}
if ((allok) && (''==country)){
 alert('Please fill in the "Country" field.');
 order.country.focus();
 allok=false;
}


if ((allok) && (!isMail(email))){
 alert('Please enter a valid email address.');
 order.email.focus();
 allok=false;
}

if ((allok) && (''==address)){
 alert('Please fill in the "Address" field');
 order.address.focus();
 allok=false;
}

if ((allok) && (''==city)) {
   alert('Please fill in the "City" field.');
   order.city.focus();
   allok=false;
}

if ((allok) && (''==state)){
 alert('Please fill in the "State/Province" field.');
 order.state.focus();
 allok=false;
}
  
if ((allok) && (''==zip)){
 alert('Please fill in the "ZIP" field ');
 order.zip.focus();
 allok=false;
}
if ((allok) && (''==country)){
 alert('Please fill in the "Country" field.');
 order.country.focus();
 allok=false;
}


return allok;
}


