var vFlashVersion = fGetFlashVersion();
var vSiteRoot = fGetRoot();
if(document.location.search.indexOf("flash=0")>-1) vFlashVersion = 0;
var vFlashOK = (vFlashVersion=4);
var W3CDOM = (document.getElementById && document.getElementsByTagName);


/* Date */
function fWriteDate(){
	var dt = new Date();
	var d = "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday".split("|");
	var m = "January|February|March|April|May|June|July|August|September|October|November|December".split("|");
	var t = "|st|nd|rd|th".split("|");
	var c = dt.getDate();
	var e = c%10;
	var f = Math.floor(c/10);
	document.write(d[dt.getDay()]+" "+c+"<sup>"+t[(e>3||f==1)?4:e]+"</sup> "+m[dt.getMonth()]+" "+dt.getFullYear());
}

function fOpenPop(){
		var p = window.open("spring2006.html", "p", centerMe(560, 379));
		if(p) p.focus();
	}
	function centerMe(w, h){
		var aw=screen.availWidth-10, ah=screen.availHeight-30;
		if(String(w).toLowerCase()=='max'){ w = aw; h = ah; } else{ if(w>aw) w = aw; if(h>ah) h = ah; }
		var l=(aw-w)/2, t=(ah-h)/2;
		return ("width="+w+",height="+h+",top="+t+",left="+l);
	}

function fWriteRandomSWF(swfName){
	if(vFlashOK){
		var num = fRandomNum(2);
		fWriteFlash("_assets/media/"+swfName+num+".swf",null,null,null,"TL");
	}else{
	var num = fRandomNum(2);
	document.write('<img src="'+vSiteRoot+'_assets/media/'+swfName+num+'.jpg" alt="" />');
 }
}
function fWriteSWF(swfName){
	if(vFlashOK){
		fWriteFlash("_assets/media/"+swfName+".swf",null,null,null,"TL");
	}else{
	document.write('<img src="'+vSiteRoot+'_assets/media/'+swfName+'.jpg" alt="" />');
 }
}

function fWriteSWFHome(){
	if(vFlashOK){
		fWriteFlash("_assets/banner/swfHomepageBanner.swf", null, null, null, "TL");
	}/*else{
	document.write('<img src="'+vSiteRoot+'_assets/media/'+swfName+'.jpg" alt="" />');
	}*/
}

function fWriteTickerTxt(){
document.write('&nbsp;<a href="'+ vSiteRoot + 'contact.aspx"><strong>Winter Sale Now On. For more information please contact us</strong></a>.');
}

function fRandomNum(range){
var num = Math.floor(Math.random()*range)+1;
return num;
}
function fWriteFlash(swf,fid,bgcolor,transparent,noscale){
	var swf = vSiteRoot + swf;
	var txt = "";
	txt += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="100%" ';
 	if(fid) txt += 'id="'+fid+'" ' ;
	txt += 'codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0">';
	txt += '<param name="movie" value="'+swf+'" />';
	txt += '<param name="menu" value="false" />';
 	if(bgcolor) txt += '<param name="bgcolor" value="'+bgcolor+'" />';
	if(noscale) txt += '<param name="scale" value="noscale" /><param name="salign" value="'+noscale+'" />';
	if(transparent) txt += '<param name="wmode" value="transparent" />';
	txt += '<embed src="'+swf+'" menu="false" width="100%" height="100%" ';
 	if(fid) txt += 'id="'+fid+'" name="'+fid+'" ' ;
	if(bgcolor) txt += 'bgcolor="'+bgcolor+'" ';
	if(noscale) txt += 'scale="noscale" salign="'+noscale+'" ';
	if(transparent) txt += 'wmode="transparent" ';
	txt += 'swLiveConnect="true" type="application/x-shockwave-flash "';
	txt += 'pluginspage="//www.macromedia.com/go/getflashplayer" />';
	txt += '</object>';
	document.write(txt);
}

/*function Scoller(obj, id, speed, pause) {
	this._UL=null;this._LIs=null;this._height=null;this._currentLI=0;
	this._speed=speed;this._pause=pause;this._name=obj;this.init(id);
}
Scoller.moveLeft = function(obj, p) { obj.moveLeft(p); }
Scoller.prototype.init = function(id){
	var e = document.getElementById(id); if(e==null) return;
	var eLi = e.getElementsByTagName("LI"); if(e==null) return;
	this._UL = e; this._LIs = eLi; this._width = Number(this._UL.offsetWidth);
	for(i in this._LIs){ fApplyStyle(this._LIs[i], "position", "absolute"); fApplyStyle(this._LIs[i], "display", "block"); fApplyStyle(this._LIs[i], "left", this._width+"px"); } this.moveLeft();
}
Scoller.prototype.moveLeft = function(move){
	if(!move) this._LIs[this._currentLI]._x = this._width;
	var cL = this._LIs[this._currentLI];
	fApplyStyle(cL, "left", cL._x+"px");
	cL._x -= 1.5;
	(cL._x>-(this._width+80)) ? setTimeout("Scoller.moveLeft("+this._name+",true);", this._speed) : this.pause();
}
Scoller.prototype.pause = function(){ setTimeout("Scoller.moveLeft("+this._name+");", this._pause); }
fAddEvent(window, "load", fInitScroller);
function fInitScroller(){	oScoller = new Scoller("oScoller", "iTicker", 1, 1000); }*/

function fGetRoot(){
	if (!document.getElementById) document.getElementById = function() { return "/"; }
	var l = document.getElementById("iPathFinder");
	if(!l||!l.href) return "/";
	l = String(l.href);
	l = l.substring(0, l.indexOf("_assets/"));
	return l;
}

function getElementsByCondition(condition,container,arg){	container = container || document; var all = container.all || container.getElementsByTagName('*'); var arr = new Array(); var e; for(var k=0; k<all.length; k++){ e = all[k]; if(condition(e,k,arg)) arr[arr.length] = e; } return arr; }
function fApplyStyle(id, style, prop){ var e = (typeof(id)=="string")?document.getElementById(id):id; if(e==null) return; if(e.style) e = e.style; e[style] = prop; }
function fAddEvent(obj, evType, fn){ if(obj.addEventListener){ obj.addEventListener(evType, fn, false); return true; } else if(obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else return false; }
function fGetFlashWModeOK(){return (navigator.platform.toLowerCase().indexOf("win")>-1)&&(navigator.appVersion.toLowerCase().indexOf('msie')>-1);}
function fGetFlashVersion(){var latestV=8;flVersion=0;var agent=navigator.userAgent.toLowerCase();if(agent.indexOf("mozilla/3")!=-1&&agent.indexOf("msie")==-1){flVersion=0;}if(navigator.plugins!=null&&navigator.plugins.length>0){var flashPlugin=navigator.plugins['Shockwave Flash'];if(typeof flashPlugin=='object'){for(var i=latestV;i>=3;i--){if(flashPlugin.description.indexOf(i+'.')!=-1){flVersion=i;break;}}}}else if(agent.indexOf("msie")!=-1&&parseInt(navigator.appVersion)>=4&&agent.indexOf("win")!=-1&&agent.indexOf("16bit")==-1){var doc='<scr'+'ipt language="VBScript"\> \n';doc+='On Error Resume Next \n';doc+='Dim obFlash \n';doc+='For i = '+latestV+' To 3 Step -1 \n';doc+='   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';doc+='   If IsObject(obFlash) Then \n';doc+='      flVersion = i \n';doc+='      Exit For \n';doc+='   End If \n';doc+='Next \n';doc+='</scr'+'ipt\> \n';document.write(doc);}else if(agent.indexOf("webtv/2.5")!=-1)flVersion=3;else if(agent.indexOf("webtv")!=-1)flVersion=2;else{flVersion=-1;}return flVersion;}
if(!Array.prototype.pop) {
	function array_pop(){ lastElement = this[this.length-1]; this.length = Math.max(this.length-1,0); return lastElement;	}
	Array.prototype.pop = array_pop;
}