/* FW100.r1 */
/* (c)2010 SugarHill Works LLC - http://www.sugarhillworks.com */

// CONFIGURE rootDir ONLY IF *LIVE* SITE ROOT IS NOT DEFAULT (http://domain.com/)
var rootDir='',rootPath='',newWin,isitIE=false,IEv,isitFF2=false,isitFF2mac=false;fullUrl=window.location.toString(),userAgent=navigator.userAgent.toLowerCase();
// -- BEG LIBRARY (settings are in jqLib) ---------------------------------------------------------------------
// mac localhost root path
if(fullUrl.search(/localhost|\.local\/\~|http\:\/\/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\/\~[a-zA-Z0-9_-]+\/?/) > -1) {
	var tmpUrl = fullUrl.replace(/.*\/\~[a-zA-Z0-9_-]+\/?/, '');
	var urlChunks = tmpUrl.split(/\//);
	rootPath = (fullUrl.match(/.*\/\~[a-zA-Z0-9_-]+\/?/)) + urlChunks[0] + '/';
}
// clientsites root path
else if (fullUrl.search(/clientsites/) > -1) {
	rootPath = (fullUrl.match(/(?:.*clientsites.sugarhillworks.com\/[a-zA-Z0-9_-]+\/?)|(?:.*sugarhillworks\.com\/clientsites\/[a-zA-Z0-9_-]+\/?)/)).toString();// + urlChunks[0] + '/';
// ------------ BOF -- TEMP FIX FOR WORKING ON SHW HQ PC ------------------
//} else if (fullUrl.search(/http\:\/\/(?:[0-9]{1,3}\.){4}/)) {
//	rootPath = fullUrl.match(/http\:\/\/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/) + '/_FW100_r1/';
// ------------- EOF -- TEMP FIX ------------------------------------------
} else if (fullUrl.search(/.*sweetscans.*/) > -1) {
	var tmpUrl = fullUrl.replace(/.*sweetscans.*\.[a-z]{3}\/?/, '');
	var urlChunks = tmpUrl.split(/\//);
	rootPath = (fullUrl.match(/http\:\/\/.*sweetscans.*\.[a-z]{3}\/?/)) + urlChunks[0] + '/';
} else {
	rootPath = fullUrl.match(/http\:\/\/(?:[a-zA-Z0-9_-]+\.{1})*[a-zA-Z0-9_-]+\.{1}[a-zA-Z]{2,4}/).toString() +'/';
}
if (window.attachEvent && !window.opera) {
	isitIE = true;
	if(navigator.appVersion.match(/MSIE 8/)) { IEv = 8; }
	if(navigator.appVersion.match(/MSIE 7/)) { IEv = 7; }
	if(navigator.appVersion.match(/MSIE 6/)) { IEv = 6; }
	document.writeln("<meta HTTP-EQUIV=\"imagetoolbar\" content=\"no\">");
}
if (/firefox[\/\s](\d+\.\d+)/.test(userAgent)) {
	var ffversion = new Number(RegExp.$1);
	if (ffversion < 3){
		isitFF2 = true;
		if (userAgent.indexOf('mac') != -1) {
			isitFF2mac = true;
		}
	}
}
if (!window.Node) {var Node = {ELEMENT_NODE: 1,ATTRIBUTE_NODE: 2,TEXT_NODE: 3,COMMENT_NODE: 8,DOCUMENT_NODE: 9,DOCUMENT_FRAGMENT_NODE: 11};}
function randOrd(){return (Math.round(Math.random())-0.5);}
// -- END LIBRARY -----------------------------------------------------------------------------------------




// -- SET UP STYLES
if ((screen.availHeight > 889)){
	var layout_sm = false;
} else {
	var layout_sm = true;
//	document.writeln('<link rel="stylesheet" type="text/css" href="'+rootPath+'shw_css/small.css" />');
//	if (screen.availHeight < 763) { 
//		document.write("<style type=\"text/css\">"+
//		"#ceibw{height:610px;background-position:0 30px;}"+
//		"#hdr{padding:10px 60px 0px 60px;}"+
//		"#main_cntr{padding:10px 60px 10px 60px;}"+
//		"</style>");
//	}
}
if (isitIE === true) {
	if (IEv <= 8) {
		document.writeln('<link rel="stylesheet" type="text/css" href="'+rootPath+'shw_css/ie678.css" />');
		if (IEv <= 7) {
			document.writeln('<link rel="stylesheet" type="text/css" href="'+rootPath+'shw_css/ie67.css" />');
			if (IEv <= 6) {
				document.writeln('<link rel="stylesheet" type="text/css" href="'+rootPath+'shw_css/ie6.css" />' +
				'<style type="text/css">' +
				'img, div, a, input { behavior: url('+rootPath+'shw_lib/iepngfix.htc); }' +
				'</style>' +
				'<script type="text/javascript" src="'+rootPath+'shw_lib/iepngfix_tilebg.js"></script>');
			}
		}
	}
}
