//Loads XML

/*XML.load = function(url) {
    var xmldoc = XML.newDocument();
    xmldoc.async = false;  
    xmldoc.load(url);
    return xmldoc;  
  };


XML.newDocument = function(rootTagName, namespaceURL) {
    if (!rootTagName) rootTagName = "";
    if (!namespaceURL) namespaceURL = "";

    if (document.implementation && document.implementation.createDocument) {
        // This is the W3C standard way to do it
        return document.implementation.createDocument(namespaceURL, 
                       rootTagName, null);
    }
    else { // This is the IE way to do it
        // Create an empty document as an ActiveX object
        // If there is no root element, this is all we have to do
        var doc = new ActiveXObject("MSXML2.DOMDocument");

        // If there is a root tag, initialize the document
        if (rootTagName) {
            // Look for a namespace prefix
            var prefix = "";
            var tagname = rootTagName;
            var p = rootTagName.indexOf(':');
            if (p != -1) {
                prefix = rootTagName.substring(0, p);
                tagname = rootTagName.substring(p+1);
            }

            // If we have a namespace, we must have a namespace prefix
            // If we don't have a namespace, we discard any prefix
            if (namespaceURL) {
                if (!prefix) prefix = "a0"; // What Firefox uses
            }
            else prefix = "";

            // Create the root element (with optional namespace) as a
            // string of text
            var text = "<" + (prefix?(prefix+":"):"") + tagname +
                (namespaceURL
                 ?(" xmlns:" + prefix + '="' + namespaceURL +'"')
                 :"") +
                "/>";
            // And parse that text into the empty document
            doc.loadXML(text);
        }
        return doc;
    }
}; 

// JavaScript Document
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function clearText(thefield)
{
if (thefield.defaultValue == thefield.value)
thefield.value = ""
      				//else thefield.value = thefield.defaultValue
	} 	
	
	function MM_preloadImages() { //v3.0
  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_swapImgRestore() { //v3.0
  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_findObj(n, d) { //v4.01
  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() { //v3.0
  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];}
}*/








//Adds text to any part of the body of a HTML
function addNode(tagParent,strText,boolAddToBack, boolRemoveNode)
{
  var strNode = document.createTextNode(strText);//holds the test which will be added
    
  //gets the properties of the node
  tagParent = getDocID(tagParent);
 
  //checks if the user whats to replace the node in order to start with a clean slate
  //it also checks if there is a chode node to replace
  if (boolRemoveNode == true && tagParent.childNodes.length > 0)
            //replaces the current node with what the user wants
            tagParent.replaceChild(strNode,tagParent.childNodes[0]);
  else
  {
            //checks if the user whats to added to the back of the id or the front
            if(boolAddToBack == true)
                        tagParent.appendChild(strNode);
            else
                        //This is a built-in function of Javascript will add text to the beginning of the child
                        insertBefore(strNode,tagParent.firstChild);
  }//end of if else
 
  //returns the divParent in order for the user to use it for more uses
  return tagParent;
}//end of addNode()
 
//removes from view all tags in tagContainer with the expection of tagActive
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayer(tagContainer,tagActive,strClassName,strTAGName)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	
	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1 ; intIndex--)
	{
		//checks if the class name is the same as strClassName and it is not active if it is active then change the dispaly to block
		if(arrTAG[intIndex].className == strClassName && arrTAG[intIndex].id != tagActive.id)
			arrTAG[intIndex].style.display = arrTAG[intIndex].style.display? "":"";
		 else if(arrTAG[intIndex].id == tagActive.id && tagActive.style.display == "")
			arrTAG[intIndex].style.display = arrTAG[intIndex].style.display? "":"block";
	}//end of for loop
}//end of classToggleLayer()

//does the display the a message in a on the page weather then an alert
function displayMessage(tagMessage,strMessText,boolAddToBack, boolRemoveNode)
{
            //gets the message properties and sets the text furthermore it does the display
            tagMessage = addNode(tagMessage,strMessText,boolAddToBack, boolRemoveNode);
            tagMessage.style.display = "block";       
           
            return tagMessage;
}//end of displayMessage()
 
//gets the document properties in order to use them as there are many types of browers with different versions
function getDocID(tagLayer)
{
            var tagProp = "";//holds the proerties of tagLayer
 
            //gets the whichLayer Properties depending of the differnt bowers the user is using
            if (document.getElementById)//this is the way the standards work
                        tagProp = document.getElementById(tagLayer);
            else if (document.all)//this is the way old msie versions work
                        tagProp = document.all[tagLayer];
            else if (document.layers)//this is the way nn4 works
                        tagProp = document.layers[tagLayer];
                       
            return tagProp;
}//end of getDocID()

//gets the XML items from strXMLString
function getXMLItems(intDisplayItems, strXMLString)
{
	/*// convert the string to an XML object
	var xmlobject = (new DOMParser()).parseFromString(xmlstring, "text/xml");
	
	// get the XML root item
	var root = xmlobject.getElementsByTagName('shoppingcart')[0];
	var date = root.getAttribute("date");

	var items = root.getElementsByTagName("item");*/
	var oldonload=window.onload;//holds any prevs onload function from the js file

	//gets the onload window event checks if there is a function that is already in there
	window.onload=function(){
		if(typeof(oldonload)=='function')
			oldonload();
			
		doc = XML.load(strXMLString);
	
		alert(doc.documentElement.firstChild.nextSibling.firstChild.nodeValue);
		
		/*for (var intIndex = 0; intIndex < intDisplayItems; intIndex++) 
		{
			// get one item after another
			var item = items[intIndex];
			
			// now we have the item object, time to get the contents
			// get the name of the item
			var name = item.getElementsByTagName("name")[0].firstChild.nodeValue;
			
			// get the quantity
			var quantity = item.getElementsByTagName("quantity")[0].firstChild.nodeValue;
		}//end of for loop*/
	}//end of window.onload=function()
}//end of getXMLItems()

//shoes and hides a <div> using display:block/none from the CSS
function toggleLayer(tagLayer,tagGrayOut,tagMedia)
{
            var tagStyle = '';//holds the style of tagLayer
 
            //gets the tagLayer and tagGrayOut Properties
            tagStyle = getDocID(tagLayer);
            tagGrayOut = getDocID(tagGrayOut);
            tagMedia = getDocID(tagMedia);
           
            if (tagStyle != null){tagStyle.style.display = tagStyle.style.display? "":"block";}
            if (tagGrayOut != null)
            {
                        tagGrayOut.style.display = tagGrayOut.style.display? "":"block";
 
                        //for IE
                        if (navigator.userAgent.indexOf('MSIE') != -1)
                        {
                                    tagGrayOut.attachEvent('onclick',function () {
                                       toggleLayer(tagStyle.id,tagGrayOut.id);
												
									//checks if there is any Media to stop also pleace remove when
									if (tagMedia != null)
										tagMedia.Stop();

                                    });
                        }//end of if
                        //for the other browsers
                        else
                        {
                                    tagGrayOut.addEventListener('click',function () {
                                                toggleLayer(tagStyle.id,tagGrayOut.id);
                                    },false);
                        }//end of else
            }//end of if
}//end of toggleLayer()

//changes the embed object of object tag
function changeFlashMovie(tagMovie,tagEmbed,tagVideoAction,strHeight,strWidth,strWmode,strPluginspage,strController,strType,strAutostart,strSRC,strTitle,strTime,tagTitle,tagTime)
{			
	//gets the properties of the tags (This is for IE)
	tagMovie = getDocID(tagMovie);
	tagEmbed = getDocID(tagEmbed);
	tagTitle = getDocID(tagTitle);
	tagTime = getDocID(tagTime);
	
	tagVideoAction = getDocID(tagVideoAction);
	
	//checks if tagMoive and tagEmded has some value (This is for IE)
	if(tagMovie != null && tagEmbed != null)
	{
		tagTitle.innerHTML = strTitle;
		tagTime.innerHTML = strTime;
		tagMovie.value = strSRC;
		//tagEmbed.src = strSRC;
				//alert(tagEmbed.src);
		tagEmbed.innerHTML = "<embed height=\"" + strHeight + "\" width=\"" + strWidth + "\" wmode=\"" + strWmode + "\" pluginspage=\"" + strPluginspage + "\" type=\"" + strType + "\" autostart=\"" + strAutostart + "\" src=\"" + strSRC + "\"/>";
		//tagVideoAction.Play();
	}//end of if
}//end of changeFlashMovie()

//changes the embed object of object tag
function changeFlashMovie2(tagMovie,tagEmbed,tagVideoAction,strHeight,strWidth,strWmode,strPluginspage,strController,strType,strAutostart,strSRC)
{			
	//gets the properties of the tags (This is for IE)
	tagMovie = getDocID(tagMovie);
	tagEmbed = getDocID(tagEmbed);
	//tagTitle = getDocID(tagTitle);
	//tagTime = getDocID(tagTime);
	
	tagVideoAction = getDocID(tagVideoAction);
	
	//checks if tagMoive and tagEmded has some value (This is for IE)
	if(tagMovie != null)
	{
		//tagTitle.innerHTML = strTitle;
		//tagTime.innerHTML = strTime;
		tagMovie.value = strSRC;
		//tagEmbed.src = strSRC;
				//alert(tagEmbed.src);
				
		if(tagEmbed != null)
			tagEmbed.innerHTML = "<embed height=\"" + strHeight + "\" width=\"" + strWidth + "\" wmode=\"" + strWmode + "\" pluginspage=\"" + strPluginspage + "\" type=\"" + strType + "\" autostart=\"" + strAutostart + "\" src=\"" + strSRC + "\"/>";
		//tagVideoAction.Play();
	}//end of if
}//end of changeFlashMovie2()

//starts up the page
//tagContainer,strClassName,strTAGName
function startUp()
{
	var oldonload=window.onload;//holds any prevs onload function from the js file

	//gets the onload window event checks if there is a function that is already in there
	window.onload=function(){
		if(typeof(oldonload)=='function')
			oldonload();
														
		//finds which browser the user is using for Firefox it is the defult
		//for IE 
		if (navigator.userAgent.indexOf('MSIE') != -1)
		{					
			//checks if IE is 7 as IE 8 is more standards compliated

			/*if(navigator.appVersion.indexOf('MSIE 7') != -1)
			{*/
				var tagCountrytabs = getDocID('countrytabs');//holds countrytabs of the news section
				
			  	//checks if there the page fo this value
			  	if(tagCountrytabs != null)
			  	{
					var tagMedia = getDocID('divMedia');//holds divSecTab of the news section
					var tagSecTab = getDocID('divSecTab');//holds divSecTab of the news section
					var tagSecTab1 = getDocID('divSecTab1');//holds divSecTab of the news section
					var tagSecTab2 = getDocID('divSecTab2');//holds divSecTab of the news section
					var tagSecTab3 = getDocID('divSecTab3');//holds divSecTab of the news section
					var tagTab4 = getDocID('aTab4');//holds divTab4 of the news section which is the last tab
										
					if(tagMedia != null)
						tagMedia.style.width = "705px";
						
					tagSecTab1.style.minHeight = "185px";
					tagSecTab.style.minHeight = "185px";
					tagSecTab3.style.minHeight = "185px";
					tagSecTab2.style.minHeight = "185px";
					tagSecTab1.style.marginTop = "-5px";
					tagSecTab.style.marginTop = "-5px";
					tagSecTab3.style.marginTop = "-5px";
					tagSecTab2.style.marginTop = "-5px";
					tagSecTab2.style.marginLeft = "-3px";
					tagTab4.style.padding = "8px 22px 5px 18px";
					
					tagCountrytabs.style.width = "737px";
					tagCountrytabs.style.marginLeft = "7px";
				  }//end of if
			//}//end of if
		}//end of if
		//for Safari and Mac
		else if (navigator.userAgent.indexOf('Safari') !=-1 || navigator.platform.indexOf("Mac") > -1)
		{
			//for firefox on the mac
			if (navigator.userAgent.indexOf('Firefox') !=-1)
			{
			}//end of if
			else
			{
				var tagMedia = getDocID('divMedia');//holds divSecTab of the news section
				var tagSecTab = getDocID('divSecTab');//holds divSecTab of the news section
				var tagSecTab1 = getDocID('divSecTab1');//holds divSecTab of the news section
				var tagSecTab2 = getDocID('divSecTab2');//holds divSecTab of the news section
				var tagSecTab3 = getDocID('divSecTab3');//holds divSecTab of the news section
				var tagTab4 = getDocID('aTab4');//holds divTab4 of the news section which is the last tab
									
				if(tagMedia != null)
					tagMedia.style.width = "705px";				
			}//end of if
		}//end of if else
		//for firefox
		else if (navigator.userAgent.indexOf('Firefox') !=-1)
		{
			var tagCountrytabs = getDocID('countrytabs');//holds countrytabs of the news section
				
			//checks if there the page fo this value
			if(tagCountrytabs != null)
			{
				var tagSecTab = getDocID('divSecTab');//holds divSecTab of the news section
				var tagSecTab1 = getDocID('divSecTab1');//holds divSecTab of the news section
				var tagSecTab2 = getDocID('divSecTab2');//holds divSecTab of the news section
				var tagSecTab3 = getDocID('divSecTab3');//holds divSecTab of the news section
				
				tagSecTab1.style.width = "175px";
				tagSecTab.style.width = "175px";
				tagSecTab3.style.width = "175px";
				tagSecTab2.style.width = "175px";
			}//end of if
		}//end of if else*/
		//for Opera
		else if (navigator.userAgent.indexOf('Opera') !=-1)
		{
		}//end of if else			
	}//end of window.onload=function()
}//end of startUp()