// JavaScript Document
var error = '';
var file = 'c-more_specs.xml';
try //Internet Explorer
	{
	 xmlDoc=new ActiveXObject('Microsoft.XMLDOM');
	 xmlDoc.async=false;
	 xmlDoc.load(file);
	}
catch(e)
	{
	 try //Firefox, Mozilla, Opera, etc.
		 {
		 xmlDoc=document.implementation.createDocument('','',null);
		 xmlDoc.async=false;
		 xmlDoc.load(file);
		 }
	 catch(e)
		 {
		 try //Google Chrome
			 {
			  var xmlhttp = new window.XMLHttpRequest();
			  xmlhttp.open('GET',file,false);
			  xmlhttp.send(null);
			  xmlDoc = xmlhttp.responseXML.documentElement;
			 }
		 catch(e)
			 {
			  error=e.message;
			 }
		 }
	}
	
modelElements=new Array();
// determine how many c-more models exist in the XML file 
	 modelElements=xmlDoc.getElementsByTagName('MODEL');
// window.alert(modelElements.length);	

featureNode=new Array();
featureName=new Array();
featureLink=new Array();
numberofNodes=0;
x=xmlDoc.getElementsByTagName('MODEL')[0].childNodes;
y=xmlDoc.getElementsByTagName('MODEL')[0].firstChild;

for (i=0;i<x.length;i++)
	{
	if (y.nodeType==1)
		{//Process only element nodes (type 1)
		featureNode[numberofNodes]=y.nodeName;
		featureName[numberofNodes]=modelElements[0].getElementsByTagName(featureNode[numberofNodes])[0].childNodes[0].nodeValue;
		featureLink[numberofNodes]=modelElements[1].getElementsByTagName(featureNode[numberofNodes])[0].childNodes[0].nodeValue;
	//	window.alert(featureName[numberofNodes]);
	//	window.alert(numberofNodes);
		numberofNodes=numberofNodes+1;
		}
	y=y.nextSibling;
	}
//window.alert(numberofNodes);


function detailsRequest(model, column)  //function displays the details of a selected C-more panel
	{

	/*First change the image that is displayed*/	
	displayPhotos(modelElements[model].getElementsByTagName('IMAGE')[0].childNodes[0].nodeValue, column);
	/*Then cycle through all the nodes to display the features for a seleted model*/
	for (i=0;i<numberofNodes;i++)
		{
//			window.alert(featureNode[i]);
//			window.alert(modelElements[model].getElementsByTagName(featureNode[i])[0].childNodes[0].nodeValue);
			changeText(featureNode[i]+column, modelElements[model].getElementsByTagName(featureNode[i])[0].childNodes[0].nodeValue);
//			window.alert("changed that one");
		}
	for (i=2;i<modelElements.length;i++)
			{
			/*Hide all the price Divs*/
			//window.alert('PRICE'+column+'COL'+i);
			document.getElementById('PRICE'+column+'COL'+i).style.display = 'none';
			}	
	/*Change the displayed price tag div, but only in the selected collumn*/
	document.getElementById('PRICE'+column+'COL'+document.getElementById('selectcolumn'+column).value).style.display = 'inline';
	}


function displayPhotos(fileName, column)
	{
	document.getElementById('picture'+column).src='../images/'+fileName;
	}


function changeText(iden, newtext) 
{
   try	{
   		var head1 = document.getElementById(iden);
   		head1.firstChild.nodeValue=newtext;
		}
	catch(e){}
		
}


function createGrayRow(id, heading, featurelink)
	{
	document.write("	<tr>");
	document.write("			<td width='14'><div style='padding-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px'><img src='../images/spacer.gif'></div></td>");
	document.write("			<td width='148' bgcolor='#91ADC2'><div style='padding-left:14px; padding-top:4px; padding-right:10px; padding-bottom:6px'>");
	if (featurelink!='No Link')
		{document.write("  		<a href='"+featurelink+"' class='style7over' style='color:#ffffff; text-decoration:none'>")
		}
		else {document.write("	<div class='style7over' style='color:#ffffff; text-decoration:none'>")}
	document.write(heading);
	if (featurelink!='No Link')
		{document.write("  		</a>")
		}
		else {document.write("	</div>")}
	document.write("			</div></td>");
	document.write("			<td width='175' background='../images/gray_bar.jpg' align='center'><div id='"+id+"1' class='style6dark' style='padding-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px'>Default</div></td>");
	document.write("			<td width='30' background='../images/gray_bar.jpg' align='right'><img src='../images/spacer.gif'></td>");
	document.write("			<td width='11' background='../images/gray_bar.jpg'><img src='../images/gray_dot.jpg' width='1' height='100%' hspace='5'></td>");
	document.write("			<td width='149' background='../images/gray_bar.jpg' align='center'><div id='"+id+"2' class='style6dark' style='padding-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px'>Default</div></td>");
	document.write("			<td width='30' background='../images/gray_bar.jpg' align='right'><img src='../images/spacer.gif'></td>");
	document.write("			<td width='22'><div style='padding-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px'><img src='../images/spacer.gif'></div></td>");
	document.write("	</tr>");
	}
	
function createWhiteRow(id, heading, featurelink)
	{
	document.write("	<tr>");
	document.write("			<td width='14'><div style='padding-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px'><img src='../images/spacer.gif'></div></td>");
	document.write("			<td width='148' bgcolor='#91ADC2'><div style='padding-left:14px; padding-top:4px; padding-right:10px; padding-bottom:6px'>");
		if (featurelink!='No Link')
		{document.write("  		<a href='"+featurelink+"' class='style7over' style='color:#ffffff; text-decoration:none'>")
		}
		else {document.write("	<div class='style7over' style='color:#ffffff; text-decoration:none'>")}
	document.write(heading);
	if (featurelink!='No Link')
		{document.write("  		</a>")
		}
		else {document.write("	</div>")}
	document.write("			</div></td>");
	document.write("			<td width='175' align='center'><div id='"+id+"1' class='style6dark' style='padding-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px'>Default</div></td>");
	document.write("			<td width='30' align='right'><img src='../images/spacer.gif'></td>");
	document.write("			<td width='11'><img src='../images/gray_dot.jpg' width='1' height='100%' hspace='5'></td>");
	document.write("			<td width='149' align='center'><div id='"+id+"2' class='style6dark' style='padding-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px'>Default</div></td>");
	document.write("			<td width='30' align='right'><img src='../images/spacer.gif'></td>");
	document.write("			<td width='22'><div style='padding-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px'><img src='../images/spacer.gif'></div></td>");
	document.write("	</tr>");
	}