/* VERSION = $Rev: 133 $ $Date: 2007-07-13 19:28:33 -0700 (Fri, 13 Jul 2007) $ */
/* This function decodes the any string
 that's been encoded using URL encoding technique */
function URLDecode( sEncodeString )
{
    // Create a regular expression to search all +s in the string
    var lsRegExp = /\+/g;
    // Return the decoded string
    return unescape(String(sEncodeString).replace(lsRegExp, " "));
}
function URLEncode( sEncodeString ) 
{
    return escape(sEncodeString)
       .replace(/\+/g, '%2B')
          .replace(/\"/g,'%22')
             .replace(/\'/g, '%27');
}
function prepHTMLValue( value )
{
    if( value != "" )
    {
        newvalue = encodeURIComponent(value);
        escvalue = escape(value);
        if( escvalue.indexOf("%u") != -1 && encode != "utf-8" )
            return value;
        else
            return newvalue;
    }
    return "";
}
function changeCursor( elementID, cursorStyle )
{
     var sElement = document.getElementById(elementID);
     if( sElement )
     {
        sElement.style.cursor = cursorStyle;
     }
}
function addInput( sType, sName, sValue )
{
   var inputRow = document.createElement('INPUT');
   inputRow.setAttribute('type', sType);
   inputRow.setAttribute('name', sName);
   inputRow.setAttribute('value', sValue);
   inputRow.setAttribute('id', sName);
   document.appendChild(inputRow);
   /* return inputRow */
}
function addButton( sValue,sName )
{
    var newButton = document.createElement("INPUT");
    newButton.setAttribute("type","button");
    newButton.setAttribute("value",sValue);
    newButton.setAttribute("name",sName);
    newButton.setAttribute("id",sName);
    document.appendChild(newButton);
    /*return newButton;*/
}
function isBrowserIE()
{
    var ie=0;
    if( navigator.appName.indexOf('Explorer')>-1 )
         ie=1;
    return ie;
}
function escapeQuot( str )
{
    s = s.replace(/"/g,"&quot;");
    return s;
}
function trim( str ) 
{
   if( str.length > 0 ) 
   {
      if( str.charAt(0)==' ' ) 
      {
        str = str.substr(1,str.length-1);
        str = trim(str);
      }
      if( str.charAt(str.length-1)==' ' ) 
      {
        str = str.substr(0,str.length-1);
        str = trim(str);
      }
   }
   return str;
}
function replaceOrRedraw( newURL )
{
    if( navigator.appVersion.charAt( 0 ) < '3' )
       parent.location = newURL;
    else
       parent.location.replace( newURL );
    return false;
}
function replaceOrRedrawParent( new_URL )
{
    //var oBase = document.all.tags('base');
    //if(oBase && oBase.target) oBase.target = _self;
    if( navigator.appVersion.charAt( 0 ) < '3' )
    	parent.location = new_URL;
    else
    	parent.location.replace( new_URL );
    return false;
}
function openNewWindow( newURL )
{
    var w = window.open(newURL, 'newwin', 'width=550,height=650,status=yes,scrollbars=yes,resizable');
    w.focus();
    return false;
}
function timeout ( )
{
    window.location.replace ('www.lauraengstrand.com'); 
    return false;
}
//window.setTimeout('timeout()', 9999999999);
function addBreaks (nbrBR)
{
var htmlString = "";
for( var i = 0; i < nbrBR; i++ )
    htmlString += "<br />"; 
document.writeln(htmlString);
}
function chooseStyleSheet()
{
  if(arguments.length > 0) {
    fileHead = cssDir + arguments[0];
  } else {
    fileHead = cssDir;
  }

  if(is_win) {
    if((is_nav) && (is_nav6up)){
      styles = fileHead + winIECSS;
    } else if(is_nav){
      styles = fileHead + winNSCSS;
    } else {
      styles = fileHead + winIECSS;
    }
  }
  else if(((is_mac) && (is_nav)) && (!is_nav6up) )
  {
    styles = fileHead + macCSS;
  }
  else
  {
  styles = fileHead + winIECSS;
  }
  var link = '<link rel="stylesheet" type="text/css" href="' + styles + '?V=' + jsv + '">';
  document.write(link);
}
function checkAgreementBox( elementID )
{
try
{
   var sElement = document.getElementById(elementID);
   var alertMsg = "To purchase, you must check the box indicating you have read and understand the agreement.";
   if( sElement != null && sElement.checked )
   {
     return true;
   }
   else
   {
     alert(alertMsg);
     return false;
   }
} catch(error){
   //non-critical
}
}
function shoppingCart( productID ) 
{
   var htmlString="<a href=\"http://www.MyMarketingCart.com/app/netcart.asp?MerchantID=105157";
   htmlString += "&ProductID=" + productID + "\">";
   htmlString += "<img src=\"./images/addcart.gif\" border=\"0\"></a>";
   document.writeln(htmlString);
}
function validateCodeBrief( str ) 
{
   if( str.length==6 ) 
   {
      if( isAlpha(str) )
      {
        return true;
      }
   }
   alert("To purchase this item, you must have a valid scholarship code.");
   return false;
}
function validateCodeFull( str ) 
{
  if( str.length==6 ) 
   {
      if( isAlpha(str) )
      {
        return true;
      }
   }
   alert("To purchase this item, you must have a valid scholarship code.");
   return false;
}
function validateFull( elementIDCheck, elementIDCode )
{
    if( checkAgreementBox(elementIDCheck) )
    {
        var sElement = document.getElementById(elementIDCode);
        if( sElement )
            return validateCodeFull(sElement.value);
    }
    return  false;
}
function validateBrief( elementIDCheck, elementIDCode )
{
    if( checkAgreementBox(elementIDCheck) )
    {
        var sElement = document.getElementById(elementIDCode);
        if( sElement )
            return validateCodeBrief(sElement.value);
    }
    return  false;
}
function isDigit(n) 
{
    if( (n < "0") || ("9" < n) ) 
    {
    return false
    }
    else 
     {
    return true
    }
}
function isAlpha( val )
{
    for( var i=0; i < val.length; i++ )
    {
        if( isDigit(val.charAt(i)) )
        {
            return false;
        }
    }
    return true;
}
var weekDayName = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var monthName = new Array ("January","February","March","April","May","June","July","August","September","October","November","December");
function writeDate( elementID )
{
    var today=new Date();
    //weekDayName[today.getDay()]+ ", " + 
    //today.getMonth()+1/today.getDay()/today.getFullYear()
    var sElement = document.getElementById(elementID);
    if( sElement != null )
    {
       sElement.value=monthName[today.getMonth()] + " " + today.getDay() + ", " + today.getFullYear();
    }
}
function bodyOnLoadWrapper()
{
   
}
function bodyOnUnLoadWrapper()
{
    
}
function formOnSubmitWrapper()
{
}

