/* --------------------------------------------------------------
FILE: Skin.js
DESCRIPTION: ExtJS Javascript extension for LSMS Private Label.  
TEMPLATE VERSION: 2.0  - Includes defaulting of company name field, and initially making the content invisible before changing it.
CUSTOMER: Cameron
LOCATION: /Content/skin/cameron
PROJECT: LMS Private Label Migration
CREATED:  5/11/10
AUTHOR: Cahow/Caruso

Mod Date    Rev #   Author      Description
--------    ------  ----------- ---------------------------------
6/16/10     2.1     Caruso      TFS #23371 - Company name defaulting fix.

(c) Copyright 2010 PureSafety
----------------------------------------------------------------- */
function setShadow(){
		
}
function setHeaderShadow(){
		
}
/*functions defined above are an LSMS bug fix. they can be removed once the bug is addressed */
/*   */
/*function below to parse URL parameters and get company name*/
function gup( cname )
{
  cname = cname.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+cname+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
var cnamevalue = gup('company');

(function() {
    /* perform the page manipulations ONLY IF this is the login page */
    if (Ext && (Ext.getDom('View_root_Login_Index') || Ext.getDom('View_root_login_Index') || Ext.getDom('View_root_Login_Login')) ) {
        var el = Ext.getDom('CompanyName');

        if (((el && el.value) || "").match(/^\s*$/)) {           // is the value empty? (zero or more spaces; only comprised of spaces)
            el.value = cnamevalue;
        }

        /* Suppress the default PureSafety graphic on the login page */
        var pics= Ext.query('.graphicCol');       // Returns an array of matches
        if (pics && pics[0]) {
            pics[0].innerHTML = '&nbsp;'; // keeps the element from collapsing
            pics[0].style.visibility = 'visible';
	}

        /* Change the default PureSafety Title and Intro Copy on the login page */
        var elems= Ext.query('.bodyCol');       // Returns an array of matches
        if (elems && elems[0]) {
		elems[0].innerHTML   = '&nbsp;'; // keeps the element from collapsing
		elems[0].style.visibility = "visible";
	}
		var helpOps= Ext.query('.helpOptions');
        if (helpOps && helpOps[0]) {
        helpOps[0].innerHTML   = 'Phone: 877-975-2667<br>Email: help@mwecc.com';
		}
    }
})();
