
//smk_faq.js file from version: 2.3.b5

function addObjEvent(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;
	}
}

//Tim, Thanks for the idea of the above function to add to the current window.onload event

function mooArrayCheck(myArray,myId){
	for(var i in myArray){
		if(myArray[i].id == myId){
			return i;
		}
	}
}

function smkShowHide(smkItem,hide){
	if (document.getElementById){
		// this is the way the standards work
		var style2 = document.getElementById(smkItem).style;
		if(hide){style2.height = "0px"; return true;}
		style2.height = style2.height == "0px"? "auto":"0px";
	}else if (document.all){
		// this is the way old msie versions work
		var style2 = document.all[smkItem].style;
		if(hide){style2.height = "0px"; return true;}
			style2.height = style2.height == "0px"? "auto":"0px";
		}
	else if (document.layers){
		// this is the way nn4 works
		var style2 = document.layers[smkItem].style;
		if(hide){style2.height = "0px"; return true;}
			style2.height = style2.height == "0px"? "auto":"0px";
		}
}


function smkShowHideDisplay(smkItem,hide){
	if (document.getElementById){
		// this is the way the standards work
		var style2 = document.getElementById(smkItem).style;
		if(hide){style2.display = "none"; return true;}
		style2.display = style2.display == "none"? "block":"none";
	}else if (document.all){
		// this is the way old msie versions work
		var style2 = document.all[smkItem].style;
		if(hide){style2.display = "none"; return true;}
		style2.display = style2.display == "none"? "block":"none";
	}
	else if (document.layers){
		// this is the way nn4 works
		var style2 = document.layers[smkItem].style;
		if(hide){style2.display = "none"; return true;}
		style2.display = style2.display == "none"? "block":"none";
	}
}

/*	dynamicCSS.js v1.0 <http://www.bobbyvandersluis.com/articles/dynamicCSS.php>
	Copyright 2005 Bobby van der Sluis
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

function createStyleRule(selector, declaration) {
	if (!document.getElementsByTagName || !(document.createElement || document.createElementNS)) return;
	var agt = navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_iewin = (is_ie && (agt.indexOf("win") != -1));
	var is_iemac = (is_ie && (agt.indexOf("mac") != -1));
	if (is_iemac) return; // script doesn't work properly in IE/Mac
	var head = document.getElementsByTagName("head")[0]; 
	var style = (typeof document.createElementNS != "undefined") ?	 document.createElementNS("http://www.w3.org/1999/xhtml", "style") : document.createElement("style");
	if (!is_iewin) {
		var styleRule = document.createTextNode(selector + " {" + declaration + "}");
		style.appendChild(styleRule); // bugs in IE/Win
	}
	style.setAttribute("type", "text/css");
	style.setAttribute("media", "screen"); 
	head.appendChild(style);
	if (is_iewin && document.styleSheets && document.styleSheets.length > 0) {
		var lastStyle = document.styleSheets[document.styleSheets.length - 1];
		if (typeof lastStyle.addRule == "object") { // bugs in IE/Mac and Safari
			lastStyle.addRule(selector, declaration);
		}
	}
}

function smkDocumentAddTag(id,tag,content,aa){
	if(document.getElementById){
		var myPos = document.getElementById(id);
		var myTag = (typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", tag) : document.createElement(tag);
		if(aa){
			for(i=0;i<aa.length;i+=2){
				myTag.setAttribute(aa[0],aa[1]);
			}
		}
		//add loop for attributes
		//class and etc to be added here
		
		var myContent = document.createTextNode(content);
		
		myTag.appendChild(myContent);
		
		var myHtml = myPos.appendChild(myTag);
	}
}

function smkDocumentWriteBR(id){
	if(document.getElementById){
		var myPos = document.getElementById(id);
		var myTag = (typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", "br") : document.createElement("br");
		var myHtml = myPos.appendChild(myTag);
	}
}
