//	Author:	Dan Kovacevic
//	Date:		01/20/2005
//	Email:		dank49@hotmail.com or dkovac1@sears.com

var myFont = '<link href="/include/scripts/MStyles.css" rel="stylesheet" type="text/css">';
var myLargerFont = '<link href="/include/scripts/LStyles.css" rel="stylesheet" type="text/css">';

if ( getStyle("fontSize") == "large" ) {
	myFont = myLargerFont;
}

document.write(myFont);

function getStyle(name) {

    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length + 1;
    if ((!start) && (name != document.cookie.substring(0,name.length)))
    	return null;
    if (start == -1)
    	return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1)
    	end = document.cookie.length;

    return unescape(document.cookie.substring(len,end));
}

function setStyle(value) {
	var name = "fontSize";
	var path = "/";
	var domain = location.host;
	var secure;
	var today = new Date();
	var expires = new Date(today.getTime() + (56 * 86400000));

    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
    window.location.reload();
}


function helper () {
	var small = '<a class="small" href="javascript:void(\'\')" onClick="setStyle(\'small\')" class="toplink_my">-smaller font</a> ';

	var larger = '<a class="small" href="javascript:void(\'\')" onClick="setStyle(\'large\')" class="toplink_my">+larger font</a> ';

	if ( getStyle("fontSize") == "small" || getStyle("fontSize") == null ) { small = larger; }

		else if ( getStyle("fontSize") == "large" ) { larger = small; }

	document.write(small);

	if (document.all) //only for IE
	document.write('<span class="gray1">&nbsp;|&nbsp;</span> <a href="javascript:printFriendly();" class="small">printer friendly</a>')
}


//		Opens external site windows without location bar and 
//		eliminates other features to keep visitor focus. 
	function xWindow(site) {

		var xWidth = 790;
		var yHeight = 600;
		var x = window.screenLeft + document.body.clientWidth - xWidth + 10;
		var y = window.screenTop;
		
		if (site == null ) {  // gives this method the ability to call it with or wihout a url param
			site = "http://jobs.brassring.com/EN/ASP/TG/cim_home.asp?PartnerId=455&amp;SiteId=185"
		}
		
		var xWin = window.open(site, "" , "width="+xWidth+  ",height="+yHeight+ ",top="+y+  ",left="+x + ", toolbar=yes,location=no,status=no,menubar=yes,scrollbars=yes,resizable=yes");
		xWin.focus();
	}
	

//Provides a printer friendly page for printing. 
//The print friendly window opens up within the browser 
//window aligned with the browsers Right most and Top most edge.
	function printFriendly() {

	var xWidth = 500;
	var yHeight = 500;
	var x = window.screenLeft + document.body.clientWidth - xWidth + 10;
	var y = window.screenTop;

	var printWin = window.open("", "printSpecial" , "width="+xWidth+  ",height="+yHeight+ ",top="+y+  ",left="+x + ", toolbar=no,location=no,status=no,menubar=yes,scrollbars=yes,resizable=yes");
	printWin.document.open();
	printWin.document.write("<head><link href='/include/scripts/MStyles.css' rel='stylesheet' type='text/css'></head>");
	printWin.document.write('<p align=right><a href="javascript:window.print()">Print</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:window.close()">Close Window</a>&nbsp;&nbsp;&nbsp;');


	printWin.document.write(myprint.innerHTML);
	printWin.document.close();
	printWin.focus();

	//if (window.print){
	//	printWin.print();
	//}
	}


function MakeArray(n) {
   this.length = n;
   return this;
}

monthNames = new MakeArray(12);
monthNames[1] = "1";
monthNames[2] = "2";
monthNames[3] = "3";
monthNames[4] = "4";
monthNames[5] = "5";
monthNames[6] = "6";
monthNames[7] = "7";
monthNames[8] = "8";
monthNames[9] = "9";
monthNames[10] = "10";
monthNames[11] = "11";
monthNames[12] = "12";
dayNames = new MakeArray(7);
dayNames[1] = "Sunday";
dayNames[2] = "Monday";
dayNames[3] = "Tuesday";
dayNames[4] = "Wednesday";
dayNames[5] = "Thursday";
dayNames[6] = "Friday";
dayNames[7] = "Saturday";

function customDate(oneDate) {
    var version = 0;
    var theDay = dayNames[oneDate.getDay() + 1];
    var theMonth = monthNames[oneDate.getMonth() + 1];
    var theYear = oneDate.getYear();

	//test browser version for date display.  This is due Netscape and IE having different values for the final theYear variable
	if (document.all&&navigator.userAgent.indexOf("Opera")==-1)
		var theYear = oneDate.getYear();
	else if (navigator.userAgent.indexOf("MSIE 5") != -1)
		var theYear = oneDate.getYear();
	else if (navigator.userAgent.indexOf("MSIE 4") != -1)
		var theYear = oneDate.getYear();
	else if (navigator.userAgent.indexOf("MSIE 4.5") != -1)
		var theYear = oneDate.getYear();
	else if (navigator.userAgent.indexOf("Mozilla/4.61") != -1)
		var theYear = oneDate.getYear() + 1900;
	else if (navigator.userAgent.indexOf("Mozilla") != -1)
		var theYear = oneDate.getYear() + 1900;

	else
		version = 8;
    return theDay + ", " + theMonth + "." + oneDate.getDate() + "." + theYear;
}


function clockTicker() {

if (document.all&&navigator.userAgent.indexOf("Opera")==-1) {
  var hours, minutes, seconds, ap;
  var intHours, intMinutes, intSeconds;
  var today;

  today = new Date();
  intHours = today.getHours();
  intMinutes = today.getMinutes();
  intSeconds = today.getSeconds();

  if (intHours == 0) {
     hours = "12:";
     ap = "AM";
  } else 
  if (intHours < 12) {
     hours = intHours+":";
     ap = "AM";
  } else if (intHours == 12) {
     hours = "12:";
     ap = "PM";
  } else {
     intHours = intHours - 12
     hours = intHours + ":";
     ap = "PM";
  }

  if (intMinutes < 10) {
     minutes = "0"+intMinutes+":";
  } else {
     minutes = intMinutes+":";
  }

  if (intSeconds < 10) {
     seconds = "0"+intSeconds+" ";
  } else {
     seconds = intSeconds+" ";
  }
  timeString = hours+minutes+seconds+ap;
  myClock.innerHTML = timeString;
  window.setTimeout("clockTicker();", 100);
 }
}

//	Author:	Dan Kovacevic
//	Date:		03/15/2006
//	Email:		dank49@hotmail.com or dkovac1@sears.com


//		Opens external site windows without location bar and 
//		eliminates other features to keep visitor focus.
//		It's a 'Common Window' eliminating multiple pop ups
//		Window opens in the upper right corner of the browser.

	function comWin(site) {

		var xWidth = 750;
		var yHeight = 550;
		var x = window.screenLeft + document.body.clientWidth - xWidth + 10;
		var y = window.screenTop;
		
		if (site == null ) {  // gives this method the ability to call it with or wihout a url param
			site = "http://jobs.brassring.com/EN/ASP/TG/cim_home.asp?PartnerId=455&amp;SiteId=185"
		}
		
		var xWin = window.open(site, "external" , "width="+xWidth+  ",height="+yHeight+ ",top="+y+  ",left="+x + ", toolbar=yes,location=no,status=no,menubar=yes,scrollbars=yes,resizable=yes");
		xWin.focus();
	}