function importXML()
{
	if (document.implementation && document.implementation.createDocument)
	{
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.onload = createTable;
	}
	else if (window.ActiveXObject)
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = function () {if (xmlDoc.readyState == 4) createTable()};
 	}
	else
	{
		alert('Your browser can\'t handle this script');
		return;
	}
	xmlDoc.load("http://www.signonsandiego.com/weather/xml/homepage_cc.xml");
}

function createTable()
{
	var x = xmlDoc.getElementsByTagName('conditions');
	for (i=0;i<x.length;i++)
	{ // begin for each tag in xmldoc
		
		for (j=0;j<x[i].childNodes.length;j++)
		{
			if (x[i].childNodes[j].nodeType != 1) continue;
			    var nodename = x[0].childNodes[j].nodeName;
			    if (nodename == "fcicon") {
			    theData = document.createElement('img');
			    //alert(theData);
			    theData.src = x[i].childNodes[j].firstChild.nodeValue;
			    theData.height = '34';
			    theData.width = '32';
			    //document.getElementById('weathericon').appendChild(theData);
			    //alert(document.getElementById('weathericon').innerHTML);
			}
			
			if (nodename == "condition") 
			{
                            theData = document.createTextNode(x[i].childNodes[j].firstChild.nodeValue);
			    anchor = document.createElement('a');
			    anchor.href = 'http://www.signonsandiego.com/news/weather/index.html';
			    anchor.appendChild(theData);
			    document.getElementById('weatherconditions').appendChild(anchor);
			    
			    //alert(document.getElementById('weatherconditions').innerHTML); 
			}

			if (nodename == "temp") 
			{
			    var degf = '°F';
                            theData = document.createTextNode(x[i].childNodes[j].firstChild.nodeValue + degf);
			    //tempfonttag.appendChild(theData);
			    anchor2 = document.createElement('a');
		    	anchor2.href = 'http://www.signonsandiego.com/news/weather/index.html';
			    anchor2.appendChild(theData);
			    document.getElementById('temp').appendChild(anchor2);
			    
			    //alert(document.getElementById('temp').innerHTML); 
			}
		}
	} // end for each tag in xmldoc
}
importXML();