var html_progressbar = "<div style='float:left;z-index:10;'><img src='images/preloader2.gif'></div><div style='font:Arial, Helvetica, sans-serif; color:#3B73B9;'>&nbsp;&nbsp;Please Wait..</div>";
//var html_progressbar = "<div style='width:50%; float:right;z-index:10;'>Please Wait...</div>";


function printCalculation()
{
	window.open("print_calculation.php","mywindow","width=800,height=800,status=0,scrollbars=0,resizable=1,menubar=1,toolbar=1");	
}

function validate(val,which)
{
	if(isNaN(val))
	{
	 alert("Please enter numeric values");
	 document.getElementById(which).value="";

	 document.getElementById("area_of_sign").value="";
	 return false;
	}
	
}


function select_color(val,colorval,psuval,s2m)
{

	var feet_matric = document.getElementById("feet_matric").value;
	//alert(feet_matric);
	if(s2m=="s2m" || s2m=="s2f")
	{	
		var url = 'getColor_powerstrip_ds.php?id='+val+'&colorval='+colorval+'&psuval='+psuval+'&s2m='+s2m;
	}
	else if(feet_matric=="meter" || feet_matric=="feet")
	{
		var url = 'getColor_powerstrip_ds.php?id='+val+'&s2m='+feet_matric;		
	}
	else
	{		
		var url = 'getColor_powerstrip_ds.php?id='+val;		
	}
	//alert(url);
	document.getElementById("color").innerHTML = html_progressbar;	
	loadXMLDoc(url);
}



function disable_option()
{
	if(document.getElementById("footage").value=="")
	{
		//document.getElementById("to_disable").style.display="block";	
		document.getElementById("height").disabled=false;
		document.getElementById("letters").disabled=false;	
		document.getElementById("strokemultiplier").disabled=false;	
	}else
	{
		document.getElementById("height").disabled="disabled";
		document.getElementById("letters").disabled="disabled";	
		//document.getElementById("letter_id").style.display="none";
		document.getElementById("strokemultiplier").disabled="disabled";	
		
	}
}


function calculate()
{
	var total;
	var total_w;
	
	var height_ft=document.getElementById("height_ft").value;
	var height_in=document.getElementById("height_in").value;
	var width_ft=document.getElementById("width_ft").value;
	var width_in=document.getElementById("width_in").value;
	var depth_in=document.getElementById("depth_in").value;
	var rows_of_led_val;
	var feetdisplay = document.getElementById("matric").style.display;
	
	if(feetdisplay=="block")
	{
		//This section is for  m/mm
		var height_cmval = (height_ft*100);		
		if(height_in)
		{
			height_cmval = parseFloat(height_cmval)+parseFloat(height_in);
		}
			
//////////////////////////
		//SEE HERE
		if(height_in)
		{//Hight+ hi_in /12
			height_metric_calc =  parseFloat(height_ft)+(parseFloat(height_in)/1000);
		}
		else
		{
			height_metric_calc =  parseFloat(height_ft);
		}
		if(width_in)
		{
			width_metric_calc =  parseFloat(width_ft)+(parseFloat(width_in)/1000);
		}
		else
		{
			width_metric_calc =  parseFloat(width_ft);
		}

		//var area_of_sign_val = Math.floor((height_metric_calc*width_metric_calc),0);	
		var area_of_sign_val = parseFloat(height_metric_calc*width_metric_calc);	
			
		
		
///////////////////////		
		//var area_of_sign_val = Math.floor(area_of_sign_val,0); //as unit is feet

		
		//alert("This="+area_of_sign_val);
		//=ROUNDDOWN((F22+(G22/12))*(F24+(G24/12));0)
//=IF(ROUNDDOWN(IF(F20<152;F24*1000/254;F24*1000/305);0)=0;1;ROUNDDOWN(IF(F20<152;F24*1000/254;F24*1000/305);0))
		document.getElementById("area_of_sign").value=area_of_sign_val;
/*		if(depth_in<16)
		{
        	var rows_of_led_val = Math.floor((width_ft*12+ width_in)/10);  
		}
		else
		{
			var rows_of_led_val =  Math.floor((width_ft*12+ width_in)/12);
		}
*/		if(depth_in<152)
		{
			//alert(width_ft*12+ width_in);
        	//var rows_of_led_val = Math.floor(((width_ft*12+ width_in)*1000)/254);  
			if(width_in)
			var rows_of_led_val = Math.floor(((parseFloat(width_ft)+ parseFloat(width_in)/1000)*1000)/254);  
			else
			var rows_of_led_val = Math.floor(((width_ft)*1000)/254);  
		}
		else
		{
			if(width_in)
			var rows_of_led_val =  Math.floor(((parseFloat(width_ft)+ parseFloat(width_in)/1000)*1000)/305);
			else
			var rows_of_led_val =  Math.floor(((width_ft)*1000)/305);
		}

		document.getElementById("rows_of_led").value=rows_of_led_val;
		
	}
	else
	{
		//This section is for  ft/inch
		var height_feet_calc="";
		var width_feet_calc="";
		if(height_in)
		{//Hight+ hi_in /12
			height_feet_calc =  parseFloat(height_ft)+(parseFloat(height_in)/12);
		}
		else
		{
			height_feet_calc =  parseFloat(height_ft);
		}
		if(width_in)
		{
			width_feet_calc =  parseFloat(width_ft)+(parseFloat(width_in)/12);
		}
		else
		{
			width_feet_calc =  parseFloat(width_ft);
		}
		
		
		if(height_ft!="")
		{			// (F22+(G22/12))*(F24+(G24/12))
			//var area_of_sign_val = Math.floor((height_feet_calc*width_feet_calc),0);	
			var area_of_sign_val = Math.floor((height_feet_calc*width_feet_calc),0);	
		}	
		if(!isNaN(area_of_sign_val))
		document.getElementById("area_of_sign").value=area_of_sign_val;
//=IF(ROUNDDOWN(IF(G20<6;(F24*12+G24)/10;(F24*12+G24)/12);0)=0;1;
	  //ROUNDDOWN(IF(G20<6;(F24*12+G24)/10;(F24*12+G24)/12);0))		
		if(depth_in<6)
		{
			//alert(width_ft);
			if(width_in!="")
        	var rows_of_led_val = Math.floor(( (parseFloat(width_ft)*12)+parseFloat(width_in))/10);  
			else
			var rows_of_led_val = Math.floor(( (parseFloat(width_ft)*12))/10);  
		}
		else
		{
			if(width_in!="")
        	var rows_of_led_val = Math.floor(( (parseFloat(width_ft)*12)+parseFloat(width_in))/12);  
			else
			var rows_of_led_val = Math.floor(( (parseFloat(width_ft)*12))/12);  
		}
		document.getElementById("rows_of_led").value=rows_of_led_val;
		
		
	}

	if(isNaN(height_ft) || isNaN(height_in) || isNaN(width_ft) || isNaN(width_in))
	{
		document.getElementById("area_of_sign").value="";
	}

}


function switchToMatric(val)
{
	var stom='';
	var height_ft=document.getElementById("height_ft").value;
	var height_in=document.getElementById("height_in").value;
	var width_ft=document.getElementById("width_ft").value;
	var width_in=document.getElementById("width_in").value;
	var depth_in=document.getElementById("depth_in").value;
	var area_of_sign=document.getElementById("area_of_sign").value;
	var rows_of_led = document.getElementById("rows_of_led").value;

	var product = document.getElementById("led_product").value;	
	var color=document.getElementById("color_s2m").value;
	
	var psu=document.frmCalculator.psu.value;
	var display = document.getElementById("results").style.display;

	var matric_h_mt,matric_w_mt;
	if(display=="block")
	{
		if(product=="")
		{
			alert("Please select as LED Product");
			document.frmCalculator.led_product.focus();
			return false;
		}		
		if(color=="")
		{
			alert("Please select a Color");
			document.frmCalculator.color.focus();
			return false;
		}
		if(psu=="")
		{
			alert("Please select a power supply");
			document.frmCalculator.psu.focus();
			return false;
		}
		if(depth_in=="")
		{
			alert("Please enter the Depth");
			document.getElementById("depth_in").focus();
			return false;
		}
		if(height_ft=="")
		{
			alert("Please enter the Height");
			document.getElementById("height_ft").focus();
			return false;
		}
		if(width_ft=="")
		{
			alert("Please enter the Width");
			document.getElementById("width_ft").focus();
			return false;
		}
	}
	if(val=="switch to matric")
	{
		document.getElementById("feet_matric").value="meter";
		
		if(height_ft!="")
		{
			var matric_h=roundNumber(height_ft * 0.3048,2);
			if(!isNaN(matric_h))
			document.getElementById("height_ft").value=matric_h;
		}
		if(width_ft!="")
		{
			var matric_w=roundNumber(width_ft * 0.3048,2);		
			if(!isNaN(matric_w))
			document.getElementById("width_ft").value=matric_w;
		}
		if(height_in!="")
		{
			//var matric_h_mt =roundNumber(height_in * 2.54,2);
			var matric_h_mt =roundNumber(height_in * 2.54 *10,2);
			if(!isNaN(matric_h_mt))
			document.getElementById("height_in").value=matric_h_mt;
		}
		if(width_in!="")
		{
			//var matric_w_mt =roundNumber(width_in * 2.54,2);		
			var matric_w_mt =roundNumber(width_in * 2.54 *10,2);		
			if(!isNaN(matric_w_mt))
			document.getElementById("width_in").value=matric_w_mt;
		}
		if(depth_in!="")
		{
			//var matric_d_mt =roundNumber(depth_in * 2.54,2);	
			var matric_d_mt =roundNumber(depth_in * 2.54 * 10,2);	//27 Jul 09 
			//alert(matric_d_mt);
			if(!isNaN(matric_d_mt))
			document.getElementById("depth_in").value=matric_d_mt; //SEE HERE NILAJA
		}

		if(height_in){	height_feet_calc =  parseFloat(matric_h)+(parseFloat(matric_h_mt)/12);}
		else{	height_feet_calc =  parseFloat(matric_h);	}
		
		if(width_in){	width_feet_calc =  parseFloat(matric_w)+(parseFloat(matric_w_mt)/12);	}
		else{	width_feet_calc =  parseFloat(matric_w);	}
		
		var area_of_sign_val = parseFloat(height_feet_calc * width_feet_calc);
		if(!isNaN(area_of_sign_val)){
		document.getElementById("area_of_sign").value=area_of_sign_val;
		}

		document.getElementById("matric").style.display="block";
		document.getElementById("feet").style.display="none";

		document.getElementById("height_m").style.display="block";
		document.getElementById("height_f").style.display="none";
		document.getElementById("height_c").style.display="block";
		document.getElementById("height_i").style.display="none";
		document.getElementById("depth_c").style.display="block";
		document.getElementById("depth_i").style.display="none";
	
		document.getElementById("width_m").style.display="block";
		document.getElementById("width_f").style.display="none";
		document.getElementById("width_c").style.display="block";
		document.getElementById("width_i").style.display="none";

		stom = 's2m';
	}
	else
	{
		document.getElementById("feet_matric").value="feet";
		
		if(height_ft!="")
		{
			var feet_h=roundNumber(height_ft / 0.3048,0);
			if(!isNaN(feet_h))
			document.getElementById("height_ft").value=feet_h;
		}
		if(width_ft!="")
		{
			var feet_w=roundNumber(width_ft / 0.3048,0);
			if(!isNaN(feet_w))
			document.getElementById("width_ft").value=feet_w;
		}
		if(height_in!="")
		{
			//var feet_h_mt =roundNumber(height_in / 2.54,0);
			var feet_h_mt =roundNumber(height_in / 25.4,0);
			if(!isNaN(feet_h_mt))
			document.getElementById("height_in").value=feet_h_mt;
		}
		if(width_in!="")
		{
			//var feet_w_mt =roundNumber(width_in / 2.54,0);		
			var feet_w_mt =roundNumber(width_in / 25.4,0);		
			if(!isNaN(feet_w_mt))
			document.getElementById("width_in").value=feet_w_mt;
		}
		if(depth_in!="")
		{
			//var depth_w_mt =roundNumber(depth_in / 2.54,0);		
			var depth_w_mt =roundNumber(depth_in / 25.4,0);		
			if(!isNaN(depth_w_mt))
			document.getElementById("depth_in").value=depth_w_mt;
		}
		
	
		
/*		if(height_in){	height_feet_calc =  parseFloat(height_ft)+(parseFloat(height_in)/12);}
		else{	height_feet_calc =  parseFloat(height_ft);	}
		
		if(width_in){	width_feet_calc =  parseFloat(width_ft)+(parseFloat(width_in)/12);	}
		else{	width_feet_calc =  parseFloat(width_ft);	}
		
		var area_of_sign_val = Math.floor(height_feet_calc * width_feet_calc);
		if(!isNaN(area_of_sign_val)){
		document.getElementById("area_of_sign").value=area_of_sign_val;
		}
*/		

		if(height_in){	height_feet_calc =  parseFloat(feet_h)+(parseFloat(feet_h_mt)/12);}
		else{	height_feet_calc =  parseFloat(feet_h);	}
		
		if(width_in){	width_feet_calc =  parseFloat(feet_w)+(parseFloat(feet_w_mt)/12);	}
		else{	width_feet_calc =  parseFloat(feet_w);	}
		
		var area_of_sign_val = Math.floor(height_feet_calc * width_feet_calc);
		if(!isNaN(area_of_sign_val)){
		document.getElementById("area_of_sign").value=area_of_sign_val;
		}

		
		document.getElementById("matric").style.display="none";
		document.getElementById("feet").style.display="block";
		
		document.getElementById("height_m").style.display="none";
		document.getElementById("height_f").style.display="block";
		document.getElementById("height_c").style.display="none";
		document.getElementById("height_i").style.display="block";
		document.getElementById("depth_c").style.display="none";
		document.getElementById("depth_i").style.display="block";
		
		document.getElementById("width_m").style.display="none";
		document.getElementById("width_f").style.display="block";
		document.getElementById("width_c").style.display="none";
		document.getElementById("width_i").style.display="block";		
		//select_color(document.getElementById("led_product").value,document.getElementById("color_s2m").value,document.getElementById("psu_s2m").value,'s2f');		
		stom = 's2f';
	}
	var area_of_sign = document.getElementById("area_of_sign").value;
	calculate();
//alert(area_of_sign);
	//By Nilaja For showing the result page after clicking on "Switch to Metric", depends on also Reset
	
	if(display=="block")
	{	
		/********  NEW FOR CALCULATE RESULT AT SWITCH TO METRIC *************/
			var unit = "";
			
			if(document.getElementById("height_m").style.display=="block")
			{
				if(document.getElementById("height_m").style.display=="block"){ unit ="m";	}
				else if(document.getElementById("height_c").style.display=="block"){ unit ="cm";	}
			}
			else
			{
				if(document.getElementById("height_f").style.display=="block") { unit ="ft";}
				else if(document.getElementById("height_i").style.display=="block") { unit ="Inches";}				
			}

			var id= product;
			var rows_of_led_val = rows_of_led;
			var url="final_switch_tetra_power_strip_ds.php?product="+product+"&color="+color+"&psu="+psu+"&area_of_sign="+area_of_sign+"&rows_of_led="+rows_of_led_val+"&depth_in="+depth_in+"&height_ft="+height_ft+"&height_in="+height_in+"&width_ft="+width_ft+"&width_in="+width_in+"&unit="+unit+"&s2m="+stom+"&id="+id;			
			
			//alert("1-==========>"+url);
			//document.getElementById("color").innerHTML = html_progressbar;
			
			loadXMLDocResult_new(url,stom);
			document.getElementById("dot_bg").style.display="block";	
			document.getElementById("results").style.display="block";
		
		/**** END NEW **********************/
		
	}
	else
	{
			
			//select_color(document.getElementById("led_product").value,document.getElementById("color_s2m").value,document.getElementById("psu_s2m").value,stom);		
		
	}
	document.getElementById("results").style.display = display;
	//End
}

function roundNumber(num,places) {
	var newnumber = Math.round(num*Math.pow(10,places))/Math.pow(10,places);
	return(newnumber);
}

function loadXMLDoc(url)
{
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send(null);
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) { 
			req.onreadystatechange = processReqChange;			
			req.open("GET", url, true);
			req.send();
		}
	}
}

function processReqChange()
{
	// only if req shows "complete"
	if (req.readyState == 4) {
		// only if "OK"
		if (req.status == 200) {
			// ...processing statements go here...
			response  = req.responseXML.documentElement;

			var urlpath='';
			for(var x = 0; response.getElementsByTagName('urlpath')[0].childNodes[x]; x++ )
			 urlpath = urlpath.concat(response.getElementsByTagName('urlpath')[0].childNodes[x].data);	
		//alert(document.getElementById("color").innerHTML);
		//alert(urlpath);
			document.getElementById("color").innerHTML = urlpath;
		//alert(document.getElementById("color").innerHTML);	

			var urlpath1='';
			//alert(response.getElementsByTagName('urlpath1')[0].childNodes[0].data);

			for(var x = 0; response.getElementsByTagName('urlpath1')[0].childNodes[x]; x++ )
			 urlpath1 = urlpath1.concat(response.getElementsByTagName('urlpath1')[0].childNodes[x].data);				
			document.getElementById("psu").innerHTML = urlpath1;
					
			return false;
		} else {
			alert("There was a problem display_tags_alpha retrieving the XML data:\n" + req.statusText);
		}
	}
}


/////////////////////////////// display result calculation  /////////////////////
function display_results(from,extra)
{
	
	var product=document.getElementById("led_product").value;
	var color=document.frmCalculator.color.value;
	var psu=document.frmCalculator.psu.value;

	var height_ft=document.getElementById("height_ft").value;	
	var height_in=document.getElementById("height_in").value;
	
	var width_ft=document.getElementById("width_ft").value;
	var width_in=document.getElementById("width_in").value;
	
	var depth_in = document.getElementById("depth_in").value;
	//var num_rows = document.getElementById("num_rows").value;
	//var num_columns = document.getElementById("num_columns").value;

	var unit = "";
	
	if(from=="s2m" || from=="s2f")
	{
 		
	}
	else
	{ 	from='';
		
		if(product=="")
		{
			alert("Please Select an LED Product");
			document.getElementById("led_product").focus();
			return false;
		}
		if(color=="")
		{
			alert("Please select a Color");
			document.frmCalculator.color.focus();
			return false;
		}
		if(psu=="")
		{
			alert("Please select a power supply");
			document.frmCalculator.psu.focus();
			return false;
		}
		if(depth_in=="")
		{
			alert("Please enter the Depth");
			document.getElementById("depth_in").focus();
			return false;
		}
		if(height_ft=="")
		{
			alert("Please enter the Height");
			document.getElementById("height_ft").focus();
			return false;
		}
		if(width_ft=="")
		{
			alert("Please enter the Width");
			document.getElementById("width_ft").focus();
			return false;
		}		
		
	}
	
	if(document.getElementById("height_m").style.display=="block")
	{
		if(height_ft!=""){ unit ="m";}		
	}
	else
	{
		unit ="ft";
	}
	calculate();
	var area_of_sign = document.getElementById("area_of_sign").value;
	var rows_of_led = document.getElementById("rows_of_led").value;
	
	
	//alert(from);alert(document.getElementById("f").style.display);
	if(from!="")
	{
		var url="final_tetra_power_strip_ds.php?product="+product+"&color="+color+"&psu="+psu+"&area_of_sign="+area_of_sign+"&rows_of_led="+rows_of_led+"&depth_in="+depth_in+"&foot="+foot+"&ht="+ht+"&let="+let+"&unit="+unit+"&s2m="+from+"&display_result=1";
		//alert("1=="+url);
		loadXMLDocResult(url,from);		
	}
	else
	{
		if(document.getElementById("height_m").style.display=="block")
		{
			var url="final_tetra_power_strip_ds.php?product="+product+"&color="+color+"&psu="+psu+"&area_of_sign="+area_of_sign+"&rows_of_led="+rows_of_led+"&depth_in="+depth_in+"&height_ft="+height_ft+"&height_in="+height_in+"&width_ft="+width_ft+"&width_in="+width_in+"&unit="+unit+"&s2m=s2f&display_result=1";
//alert("2=="+url);
			loadXMLDocResult(url);		
		}
		else
		{
			var url="final_tetra_power_strip_ds.php?product="+product+"&color="+color+"&psu="+psu+"&area_of_sign="+area_of_sign+"&rows_of_led="+rows_of_led+"&depth_in="+depth_in+"&height_ft="+height_ft+"&height_in="+height_in+"&width_ft="+width_ft+"&width_in="+width_in+"&unit="+unit+"&s2m=s2m&display_result=1";
//alert("3=="+url);
			loadXMLDocResult(url);	
		}
		
		
	}
	if(from=="s2m" || from=="s2f")
	{

//select_color(document.getElementById("led_product").value,document.getElementById("color_s2m").value,document.getElementById("psu_s2m").value,from); //see here
		if(document.getElementById("results").style.display)
		{
			document.getElementById("dot_bg").style.display="block";	
			document.getElementById("results").style.display="block";
		}
		else
		{
			document.getElementById("dot_bg").style.display="none";	
			document.getElementById("results").style.display="none";			
		}

	}
	else
	{
		document.getElementById("dot_bg").style.display="block";	
		document.getElementById("results").style.display="block";
	}
	
	browser_version = navigator.appVersion;
	b_ver = browser_version.split(";");
	ver = b_ver[1].split(" ");
	browser_type = navigator.appName;
	browser_version = parseInt(navigator.appVersion);
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
	{ //test for MSIE x.x;
	 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	}
	
	if(from!="s2m" && from!="s2f")
	{
		document.getElementById("page").style.height="540px";	
	}
	return false;
}


function reset_func()
{
	document.frmCalculator.reset();
	document.getElementById("results").style.display="none";
	document.getElementById("dot_bg").style.display="none";	
	document.getElementById("page").style.height="290px";
	return false;
}

function loadXMLDocResult(url,from)
{
	if(from!="")
	{		
		//select_color(document.getElementById("led_product").value,document.getElementById("color_s2m").value,document.getElementById("psu_s2m").value,from);
	}
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange =processReqChangeResult;
		req.open("GET", url, true);
		req.send(null);
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processReqChangeResult;
			req.open("GET", url, true);
			req.send();
		}
	}
}

function processReqChangeResult()
{
	// only if req shows "complete"
	if (req.readyState == 4) {
		// only if "OK"
		if (req.status == 200) {
			// ...processing statements go here...
			response  = req.responseXML.documentElement;

			var urlpath='';
			for(var x = 0; response.getElementsByTagName('urlpath')[0].childNodes[x]; x++ )
			 urlpath = urlpath.concat(response.getElementsByTagName('urlpath')[0].childNodes[x].data);		
			 
			document.getElementById("results").innerHTML = urlpath;
	
	
			return false;
		} else {
			alert("There was a problem display_tags_alpha retrieving the XML data:\n" + req.statusText);
		}
	}
}


function loadXMLDocResult_new(url,from)
{
	if(from!="")
	{		
		//select_color(document.getElementById("led_product").value,document.getElementById("color_s2m").value,document.getElementById("psu_s2m").value,from);
	}
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange =processReqChangeResultNew;
		req.open("GET", url, true);
		req.send(null);
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processReqChangeResultNew;
			req.open("GET", url, true);
			req.send();
		}
	}
}

function processReqChangeResultNew()
{
	// only if req shows "complete"
	if (req.readyState == 4) {
		// only if "OK"
		if (req.status == 200) {
			// ...processing statements go here...
			response  = req.responseXML.documentElement;


			var urlpath1='';var urlpath2='';
			//for(var x = 0; response.getElementsByTagName('urlpath1')[0].childNodes[x]; x++ )
			//urlpath1 = urlpath1.concat(response.getElementsByTagName('urlpath1')[0].childNodes[x].data);				
			//document.getElementById("color").innerHTML = urlpath1;
			
			//alert(urlpath1);
			//for(var x = 0; response.getElementsByTagName('urlpath2')[0].childNodes[x]; x++ )
			//urlpath2 = urlpath2.concat(response.getElementsByTagName('urlpath2')[0].childNodes[x].data);				
			//document.getElementById("psu").innerHTML = urlpath2;
//alert(urlpath1);alert(urlpath2);

			var urlpath='';
			for(var x = 0; response.getElementsByTagName('urlpath')[0].childNodes[x]; x++ )
			 urlpath = urlpath.concat(response.getElementsByTagName('urlpath')[0].childNodes[x].data);				
			 
			document.getElementById("results").innerHTML = urlpath;
			

			return false;
		} else {
			alert("There was a problem display_tags_alpha retrieving the XML data:\n" + req.statusText);
		}
	}
}
////////////////////////////////////////////////////////////////////////////////


