/***** SBCentre.ca » Small Business Centre » Developed by ScriptReaction » www.scriptreaction.com *****/

/********** global items **********/
var global = {
	launch: function (){
		//flashFilter: params: brd=borderWidth, brdclr=borderColour(default=fff), var=varInName, value=varInValue, name=flashMovieId, src, wmode(default=opaque)
		var divArray = document.getElementsByTagName("div");
		for(var divCount=0; divCount<divArray.length; divCount++){
			var whichDiv = divArray[divCount];
			var divClass = whichDiv.className;
			if(divClass != "" && (divClass == "flash" || divClass == "flash2")){
				var divId = "flashCtr_" + divCount;
				whichDiv.setAttribute("id", divId);
				var _width = parseInt(whichDiv.style.width);
				var _height = parseInt(whichDiv.style.height);
				var _border = parseInt(whichDiv.getAttribute("brd"));
				if(_border > 0){
					var _colour = whichDiv.getAttribute("brdclr");
					_colour = (_colour == null) ? "fff" : _colour;
					whichDiv.style.border = _border + "px solid #" + _colour;
				}else{
					whichDiv.style.border = "0px";
				}
				var _var = whichDiv.getAttribute("var");
				if(_var != null){
					_value = eval(whichDiv.getAttribute("value"));	
				}else{
					_var = _value = '';
				}
				var _name = whichDiv.getAttribute("name");
				var _id = (_name != null) ? _name : "";
				var _src = whichDiv.getAttribute("src");
				var _wmode = whichDiv.getAttribute("wmode");
				_wmode = (_wmode != null) ? _wmode : "opaque";
				
				var x = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+flashFilter.fv[0]+',0,0,0" width="'+_width+'" height="'+_height+'" id="'+_id+'" align="absmiddle">';
					x+= '<param name="movie" value="'+_src+'" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="'+_wmode+'" /><param name="flashvars" value="'+_var+'='+_value+'" /><param name="swliveconnect" value="true" />';
					x+= '<embed src="'+_src+'" width="'+_width+'" height="'+_height+'" flashvars="'+_var+'='+_value+'" name="'+_id+'" wmode="'+_wmode+'" quality="high" menu="false" swliveconnect="true" align="absmiddle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></object>';
				
				//no flash player
				if(!global.hasFlash) x = '<div class="noflash" style="width:'+_width+'px;height:'+_height+'px;"><a href="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">Your Flash Player needs to be upgraded to view this content. Visit Adobe.com...</a></div>';
				
				global.setDivContent(divId,x);
			}
		}
		<!-- global image actions -->
		for(var a=0; a<document.links.length; a++){
			var b = document.links[a];
			if(b.id == 'lk'){
				b.onclick = function (){
					return false;
				}
			}
			if(b.className == "liNav"){
				b.onclick = function(){
					return false;
				}
			}
		}
		<!-- "go" image actions -->
		var gocount = 0;
		for(var a=0; a<document.images.length; a++){
			var b = document.images[a];
			if(b.name == "srx") b.alt = "";
			if(b.src.slice(-7) == "sbc.gif") b.alt = "";
			if(b.className == "go" || b.className == "go2" || b.className == "go3"){
				b.className = b.className + " png";
				b.onmouseover = function(){
					this.src = "assets/gfx/go_ov.png";
				}
				b.onmouseout = function(){
					this.src = "assets/gfx/go_ou.png";
				}
				b.title = b.alt;
			}
			b.border = 0;
			b.galleryimg = "no";
		}
		<!-- "go" list item actions -->
		var a = document.getElementsByTagName("li");
		for(var b=0; b<a.length; b++){
			var c = a[b];
			if(c.className == "goitem"){
				c.onmouseover = function(){
					global.dogo_ov( this.value );
				}
				c.onmouseout = function(){
					global.dogo_ou( this.value );
				}
			}
		}
	},
	goTop: function (){
		var y1=y2=y3=0;if(document.documentElement){y1=document.documentElement.scrollTop||0;};if(document.body){y2=document.body.scrollTop||0;};
		y3=window.scrollY||0;var y=Math.max(y1,Math.max(y2,y3));window.scrollTo(0,Math.floor(y/1.4));if(y>0){window.setTimeout("global.goTop()",25);};
	},
	getNav: function (){
		var x = '<div id="prt"><img src="assets/gfx/printhead.gif" /></div>'; //prt = print container
		if(global.hasFlash){
			x+= '<div id="nav"><div align="center"><div id="menu">';
			x+= '<div class="flash" src="assets/nav/menu.swf?'+(Math.random()*999999999)+'" wmode="transparent" var="pg" value="pg" style="width:774px;height:245px;"></div>';
			x+= '</div></div><div id="exa"></div><div id="exb"></div><div id="exc"></div><div id="bg"></div></div>';
		}
		document.write(x);
	},
	getSide: function (){
		var x = '<div id="bg"><img src="assets/gfx/side_bg.png" width="196" height="100%" class="png" /></div>';
			x+= '<div id="dsp">';
			x+= '<div class="flash2" src="calendar/calendar_sm.swf" wmode="transparent" style="width:196px;height:226px;"></div>';
			x+= '<div class="flash2" src="news/sbc-side-items_v2.swf?'+(Math.random()*999999999)+'" wmode="transparent" style="width:196px;height:300px;"></div>'; //random() kills cache
			x+= '<div class="release"></div>';
			x+= '</div>';
		document.write(x);
	},
	getCalList: function (){
		var x = '';
			x+= '<div class="flash2" src="calendar/calendar_list.swf?'+(Math.random()*999999999)+'" style="width:360px;height:239px;"></div>';
			x+= '';
		document.write(x);
	},
	getCvr: function (){
		document.write('<div id="cvr"></div>');
	},
	emailcount: 0,
	email: function (){
		global.emailcount++;
		/*domain*/ var a = arguments[0];
		/*ca,com*/ var b = arguments[1];
		/*idname*/ var c = arguments[2];
		if(typeof(c) == "undefined"){
			c = b;
			b = "com";
		}
		this["email" + global.emailcount] = c + "@" + a + "." + b;
		document.write('<span onclick="global.doEmail(' + global.emailcount + ')"><a href="http://www.sbcentre.ca/" id="lk">' + this["email" + global.emailcount] + '</a></span>');
	},
	doEmail: function (){
		var a = arguments[0]; top.location = "mailto:" + this["email" + a];
	},
	forceEmail: function (){
		/*domain*/ var a = arguments[0];
		/*ca,com*/ var b = arguments[1];
		/*idname*/ var c = arguments[2];
		if(typeof(c) == "undefined"){
			c = b;
			b = "com";
		}
		var address = c + "@" + a + "." + b;
		var additions = global.getEmailAdds();
		top.location = "mailto:" + address + additions;		
	},
	getEmailAdds: function (){
		if(global.emailSubject > ""){
			var output = global.emailSubject;
			global.emailSubject = "";
			return "?subject=" + output;
		}else{
			return "";
		}
	},
	alts2titles: function (){
		for(var a=0; a<document.images.length; a++){
			var b = document.images[a];
			if(b.alt > "") b.title = b.alt;
		}
	},
	dogo_ov: function (x){
		MM_swapImage("go" + x, "", "assets/gfx/go_ov.png", 1);
	},
	dogo_ou: function (x){
		MM_swapImage("go"+x, "", "assets/gfx/go_ou.png", 1);
	},
	holder: function (x){
		return global.holdtab(x, 1);
	},
	holder2: function (x){
		return global.holdtab(x, 2);
	},
	holdtab: function (x,y){
		var a = (y==2) ? "2" : "";
		var b = '<table width="175" border="0" cellpadding="0" cellspacing="0">';
			b+= '<tr><td class="bxhead smhead' + a + '_hold"><div></div></td></tr>';
			b+= '<tr><td height="' + x + '" class="bxbody smbody_hold"><div></div></td></tr>';
			b+= '<tr><td class="bxfoot smfoot_hold"><div></div></td></tr></table>';
		document.write(b);
	},
	setDivContent: function (divId, content){
		if(document.all){
			document.all[divId].innerHTML = content;
		}else{
			document.getElementById(divId).innerHTML = content;
		}
	},
	addEvent: function (object, eventType, functionName){
		if(object.addEventListener){
			object.addEventListener(eventType, functionName, false);
			return true;
		}else if(object.attachEvent){
			var x = object.attachEvent("on" + eventType, functionName);
			return x;
		}else{
			return false;
		}	
	},
	setAlpha: function (object, opacity){
		opacity = (opacity == 100) ? 99.999 : opacity;
		object.style.filter = "alpha(opacity:" + opacity + ")"; //ie/win
		object.style.KHTMLOpacity = opacity/100; //safari<1.2,konqueror
		object.style.MozOpacity = opacity/100; //older mozilla/firefox
		object.style.opacity = opacity/100; //safari 1.2,newer firefox/mozilla,css3
	}
}
var flashFilter = { //a ScriptReaction extension of: Unobtrusive Flash Objects (flashFilter) v3.20 <http://www.bobbyvandersluis.com/ufo/
	controls: {
		minPlayerVersion: 6
	},
	launch: function (){
		flashFilter.fv = [0,0];
		flashFilter.detectVersion();
		global.hasFlash = (flashFilter.hasVersion(flashFilter.controls.minPlayerVersion)) ? true : false;
		if(!global.hasFlash){ //no flash
			var x = "<style>";
				x+= "#shell #ftr #ctr #bg { display:block; height:123px; top:-17px; background:url(assets/gfx/ftr.png) no-repeat; }";
				x+= "#shell #ftr #ctr #lks { display:block; }";
				x+= "#shell #ftr #ctr #srl { display:block; top:81px; }";
				x+= "#shell #ftr #ctr #srl2 { display:none; }";
				x+= "";
				x+= "</style>";
			document.write(x);
		}
	},
	hasVersion: function(major) {
		return (flashFilter.fv[0] > major) ? true : false;
	},
	detectVersion: function (){
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
			flashFilter.pluginType = "npapi";
			var _d = navigator.plugins["Shockwave Flash"].description;
			if (typeof _d != "undefined") {
				_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
				var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
				flashFilter.fv = [_m, _r];
			}
		}
		else if (window.ActiveXObject) {
			flashFilter.pluginType = "ax";
			try { // avoid fp 6 crashes
				var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e) {
				try { 
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					flashFilter.fv = [6, 0];
					_a.AllowScriptAccess = "always"; // throws if fp < 6.47 
				}
				catch(e) {
					if (flashFilter.fv[0] == 6) return;
				}
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e) {}
			}
			if (typeof _a == "object") {
				var _d = _a.GetVariable("$version"); // bugs in fp 6.21/6.23
				if (typeof _d != "undefined") {
					_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
					flashFilter.fv = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
				}
			}
		}
	}
}

/********** global init **********/
flashFilter.launch();
if(navigator.appName != "Netscape"){ document.write("<style>body{overflow:auto;}</style>"); };
global.addEvent(window, "load", global.launch);

/********** embed **********/
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;};
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
	if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];};};};
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf('?'))>0&&parent.frames.length){
	d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);};if(!(x=d[n])&&d.all) x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;};
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
	if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];};};