//	Author:	Dan Kovacevic
//	Date:		04/3/2007
//	Email:		dank49@hotmail.com or dkovac1@sears.com

var myFont = '<link href="/include/css/sh.css" rel="stylesheet" type="text/css">';
var myLargerFont = '<link href="/include/css/sh_large.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="nav-text-link" href="javascript:void(\'\')" onClick="setStyle(\'small\')" class="toplink_my">Smaller Text</a> ';

	var larger = '<a  class="nav-text-link" href="javascript:void(\'\')" onClick="setStyle(\'large\')" class="toplink_my">Larger Text</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.
//		It's a 'Common Window' eliminating multiple pop ups
//		Window opens in the upper right corner of the browser.

	function comWin(site) {

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

		if (site == null ) {  // gives this method the ability to call it with or wihout a url param
			site = "http://www.searsholdings.com/"
		}
		
		var xWin = window.open(site, "x" , "width="+xWidth+  ",height="+yHeight+ ",top="+y+  ",left="+x + ", toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes");
		xWin.focus();
	}
	
	
	//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/css/sh.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(friendly.innerHTML);
		printWin.document.close();
		printWin.focus();
	
		//if (window.print){
		//	printWin.print();
		//}
	}
