﻿	<!-- Begin
	/* This script and many more are available free online at
	The JavaScript Source!! http://javascript.internet.com
	Created by: Ultimater :: http://ultimiacian.tripod.com/
	Add this snippet to the very beginning of your script. */

	if(!document.getElementById){
	if(document.all)
	document.getElementById=function(){
		if(typeof document.all[arguments[0]]!="undefined")
		return document.all[arguments[0]]
		else
		return null
	}
	else if(document.layers)
	document.getElementById=function(){
		if(typeof document[arguments[0]]!="undefined")
		return document[arguments[0]]
		else
		return null
	}
	}
	// End -->

	browserName=navigator.appName;
	browserVer=parseInt(navigator.appVersion);
	
	if (browserVer > 2) {
	
	Services_R = new Image(99, 37);
	Services_R.src="images/Services_R.gif";
	Services_O = new Image(99, 37);
	Services_O.src="images/Services_O.gif";		

	CaseStudies_R = new Image(140, 37);
	CaseStudies_R.src="images/CaseStudies_R.gif";
	CaseStudies_O = new Image(140, 37);
	CaseStudies_O.src="images/CaseStudies_O.gif";		
	
	AboutUs_R = new Image(111, 37);
	AboutUs_R.src="images/AboutUs_R.gif";
	AboutUs_O = new Image(111, 37);
	AboutUs_O.src="images/AboutUs_O.gif";			
	
    News_R = new Image(92, 37);
	News_R.src="images/News_R.gif";
	News_O = new Image(92, 37);
	News_O.src="images/News_O.gif";			
			
	ContactUs_R = new Image(103, 37);
	ContactUs_R.src="images/ContactUs_R.gif";
	ContactUs_O = new Image(103, 37);
	ContactUs_O.src="images/ContactUs_O.gif";		
	
	Create_R = new Image(353, 174);
	Create_R.src="images/Create_R.gif";
	Create_O = new Image(353, 174);
	Create_O.src="images/Create_O.gif";		
	
	Build_R = new Image(353, 174);
	Build_R.src="images/Build_R.gif";
	Build_O = new Image(353, 174);
	Build_O.src="images/Build_O.gif";		
		
	Connect_R = new Image(353, 174);
	Connect_R.src="images/Connect_R.gif";
	Connect_O = new Image(353, 174);
	Connect_O.src="images/Connect_O.gif";		

	DashImg = new Image(9, 14);
	DashImg.src="images/SideNavDash.gif";
	ClearImg = new Image(9, 14);
	ClearImg.src="images/Clear.gif";
	
}

	
	function RollIt(imgName) {
		var el = document.getElementById(imgName);
		el.src = eval(imgName + "_O.src");
		
    }
	
	function UnRollIt(imgName) {
		var el = document.getElementById(imgName);
		el.src = eval(imgName + "_R.src");
	}
	
	function RollIt_v2(imgName, DDFS, GorJ) {
	
		var el = document.getElementById(imgName);
		var img = new Image();
		img.src = DDFS + 'images/CloudConfig/' + imgName + '_O.' + GorJ;
		el.src = img.src;
	}
	
	function UnRollIt_v2(imgName, DDFS, GorJ) {
	
		var el = document.getElementById(imgName);
		var img = new Image();
		img.src = DDFS + 'images/CloudConfig/' + imgName + '_R.' + GorJ;
		el.src = img.src;
		
	}	
	
	function Dash_Roll(imgName) {
		var el = document.getElementById(imgName);
		if (el != null) {
				el.src = DashImg.src;
		}
	}
		
	function Dash_UnRoll(imgName) {
		var el = document.getElementById(imgName);
		if (el != null) {
				el.src = ClearImg.src;
		}

	}	
	
	
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


var _QtCnt = -1
var _Quotes = new Array()

_Quotes[0] = '1.6.2011 - <span style="color: #6d6e70;">Workplace Solutions launches new web site.</span>'; 
_Quotes[1] = '1.20.2011 - <span style="color: #6d6e70;">Workplace Solutions receives highest honor in customer satisfaction and performance.</span>'; 

function RotateNews(Direction) {

    var el;
    var html;

    _QtCnt = _QtCnt + 1;
    if ( _QtCnt > _Quotes.length - 1 ) {  _QtCnt = 0 }
    html = _Quotes[_QtCnt];
    el = document.getElementById('divNewsItem');
    el.innerHTML = html;
        
}

function FindMyControl(MyID) {

	var frmElements,i,t,ctl;
	
	// Since the use of master pages mangles the names of child controls, we need a method 
	// of searching through the form elements and returning a reference to the control we are 
	// looking for that control by the name we know it as instead of the dumb-ass name ASP.Net creates.
	// First scan through all of the input elements and look for our control
    frmElements=document.getElementsByTagName('input');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    }
   // Still not found, scan through all of the select elements
    frmElements=document.getElementsByTagName('select');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    } 
   
   // Still not found, scan through all of the textarea elements
    frmElements=document.getElementsByTagName('textarea');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    }
   
   // Still not found, scan through all of the textarea elements
    frmElements=document.getElementsByTagName('td');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    }      
   
   // Still not found, scan through all of the textarea elements
    frmElements=document.getElementsByTagName('img');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    }     

   // Still not found, scan through all of the iframe elements
    frmElements=document.getElementsByTagName('div');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    }        
   
    return false;         

}       

function validEmail(email) 
{
     var invalidChars = " /:,;"; // NOTE - first char is a SPACE

     for (i = 0;  i < invalidChars.length; i++) { // does it contain any invalid characters?
          var badChar = invalidChars.charAt(i);
          if (email.indexOf(badChar, 0) > -1) return false;
     }

     var atPos = email.indexOf("@", 1);  // there must be one "@" symbol
     if (atPos == -1) return false;
     // and only one "@" symbol
     if (email.indexOf("@", atPos + 1) != -1) return false;

     periodPos = email.indexOf(".", atPos);
     // and at least one "." after the "@"
     if (periodPos == -1) return false;
     // must be at least 2 characters after the "."
     if (periodPos + 3 > email.length)  return false;

     return true;
}

function SubmitContactUs() {

    var el;
    
    el = FindMyControl('txtFirst_Name');
    if ( el.value.length <= 1 ) { alert('First name is a required field in order to contact us.  Please go back and provide a value for this item.'); return; }
    el = FindMyControl('txtCompany');
    if ( el.value.length <= 1 ) { alert('Company is a required field in order to contact us.  Please go back and provide a value for this item.'); return; }    
    el = FindMyControl('txtEmail');
    if ( el.value.length <= 4 ) { alert('Email is a required field in order to contact us.  Please go back and provide a value for this item.'); return; }            
    el = FindMyControl('txtPhone');
    if ( el.value.length <= 4 ) { alert('Phone is a required field in order to contact us.  Please go back and provide a value for this item.'); return; }                
        
    el.form.submit();
    
}


function PositionSearchBox() {

    var el,left,top,html,el2;
   
    el = document.getElementById('imgHeader_Right');
    if (el != null) {
         t = findPos(el);
         left = parseInt(t[0]);
         top = parseInt(t[1]);
    }  
    else {
        left = 100;  
        top = 100; 
    }       
    
    left = left + 545;
    top = top + 70;
    left = String(left) + 'px';
    top = String(top) + 'px';
    
    // show the pic layer
    el2 = document.getElementById('divSearchBox');
	el2.style.left = left; 
	el2.style.top = top;

}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function ShowPhotoLarger(POA_ID, W, H) {

    var el,left,top,html,el2;
   
    el = document.getElementById('img' + POA_ID);
    if (el != null) {
         t = findPos(el);
         left = parseInt(t[0]);
         top = parseInt(t[1]);
    }  
    else {
        left = 100;  
        top = 100; 
    }       
    
    left = (left + 180);
    top = top - 100;
    left = String(left) + 'px';
    top = String(top) + 'px';
    
    // set html
    html = '<img src="GetFile.aspx?Type=Photo&POA_ID=' + POA_ID + '" width="' + W + '" height="' + H + '" alt="" />';
    // show the pic layer
    el2 = document.getElementById('divPhotoLarger');
    el2.innerHTML = html;
	el2.style.left = left; el2.style.top = top;
}

function HidePhoto() {

    var el;
    
    el = document.getElementById('divPhotoLarger');
    el.style.left = '-1200px';
        
}

function SubmitEventRegistration() {

    var el;
    
    el = FindMyControl('txtFirst_Name');
    if ( el.value.length <= 1 ) { alert('First Name is a required field in order to contact us.  Please go back and provide a value for this item.'); return; }
    el = FindMyControl('txtLast_Name');
    if ( el.value.length <= 1 ) { alert('Last Name is a required field in order to contact us.  Please go back and provide a value for this item.'); return; }    
    el = FindMyControl('txtAddress');
    if ( el.value.length <= 1 ) { alert('Last Name is a required field in order to contact us.  Please go back and provide a value for this item.'); return; }        
    el = FindMyControl('txtEmail');
    if ( el.value.length <= 4 ) { alert('Email is a required field in order to contact us.  Please go back and provide a value for this item.'); return; }            
       
    el.form.submit();
    
}

