/* Used to send mail from news_detail pages.*/
function goto(u)
{
	document.location = u;
}

function contact()
{
	var source = strApplicationRoot + "modules/module_123/include/mailto.asp?iAuthorId=" + document.getElementById("Au_id").innerHTML;
	document.getElementById("PostIt").src = source;
}
/* USED IN FORUM IN MODULE_123 - FOR PETRO - DO NOT DELETE */
function fjsToolBox_setAttribute(oNode, strAttribute, strValue) 
	{
		if (oNode.getAttributeNode(strAttribute)) 
		{
			for (var i = 0; i < oNode.attributes.length; i++) {
				var attrName = oNode.attributes[i].name.toUpperCase();
				if (attrName == strAttribute.toUpperCase()) 
				{
					oNode.attributes[i].value = strValue;
				}
			}				
		}
		else {
			//create a new attribute 
			oNode.setAttribute(strAttribute, strValue);
		}
	}

	
	//retrieves content from text nodes
	function fjsToolBox_GetTextNodeContent(n) 
	{			
		var s = '';
		var children = n.childNodes;
		for(var i = 0; i < children.length; i++) 
		{
			var child = children[i];
			if (child.nodeType == 3 /*Node.TEXT_NODE*/) 
			{
				s += child.data;
			}
			else{ 
				s += getTextContent(child);
			}
		}
		return s;
	}	
	
	
	//Removes all content from a Node
	function fjsToolBox_RemoveNodes(oNode)
	{
	    while(oNode.firstChild) 
	    {
	        oNode.removeChild(oNode.firstChild);
        }
	}
	
if(!document.importNode)
{
	document._importNode = function(oNode, bImportChildren)
	{
		var oNew;
        var attr;
        
		if(oNode.nodeType == 1){
			oNew = document.createElement(oNode.nodeName);
			/*
			for(var i = 0; i < oNode.attributes.length; i++){
				oNew.setAttribute(oNode.attributes[i].name, oNode.attributes[i].value);
			}
			*/
			for (var i = 0; i < oNode.attributes.length; i++)
            {
                attr = oNode.attributes[i];
                if (attr.nodeValue != null && attr.nodeValue != '')
                {
                    //oNew.setAttribute(attr.name, attr.nodeValue);
                    fjsToolBox_setAttribute(oNew, attr.name, attr.nodeValue);
                }
            }
			oNew.style.cssText = oNode.style.cssText;
		} else if(oNode.nodeType == 3){
			oNew = document.createTextNode(oNode.nodeValue);
		}
    	
		if(bImportChildren && oNode.hasChildNodes()){
			for(var oChild = oNode.firstChild; oChild; oChild = oChild.nextSibling){
				oNew.appendChild(document._importNode(oChild, true));
			}
		}
		        	
		return oNew;
	}
}
//Expand jquery with a new funtion to compare dom nodes
jQuery.fn.equals = function(compareTo) { 
        if (!compareTo || !compareTo.length || this.length!=compareTo.length) 
{ 
                return false; 
        } 
        for (var i=0; i<this.length; i++) { 
                if (this[i]!==compareTo[i]) { 
                        return false; 
                } 
        } 
        return true; 
} 

//Petromedia menu thingamajigg
PetroMenu = function(){
	var jqPrevParent = null;
}
PetroMenu.onMouseOver = function(node){
	var that = this;
	if (that.jqPrevParent == null){
	    that.jqPrevParent = jQuery("#SiteMenu .Parent");
	}
	jQuery(that.jqPrevParent).removeClass("Parent");
	jQuery(node).addClass("Parent");
}
PetroMenu.onMouseOut = function(node){
	var that = this;
	jQuery(that.jqPrevParent).addClass("Parent");
	if (!jQuery(node).equals(that.jqPrevParent)) {
	    jQuery(node).removeClass("Parent");
	}
}
