function getHTTPObject()
{
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
  		xmlhttp=new XMLHttpRequest()
	// code for IE
	else if (window.ActiveXObject)
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	return xmlhttp;
}

var http = getHTTPObject();

function displayreview(val)
{
	if(val == "WrtRev")
	{
		if(document.getElementById('prdrev'))
			document.getElementById('prdrev').style.display =  'none';
		if(document.getElementById('addreview'))
			document.getElementById('addreview').style.display =  '';
		id1="";
		if(document.getElementById('prdrev')){
			document.getElementById('tab1').className = 'prod-reviewbg-a';   
			document.getElementById('tab1').innerHTML = "Additional info";
			}
		if(document.getElementById('addreview')){
			document.getElementById('tab2').className = 'prod-reviewbg-i'; 
			document.getElementById('tab2').innerHTML = "<a href='#' class='graylink' onclick='displayreview(id1);return false;'>Details</a>";
		}
	}
	else
	{
		if(document.getElementById('prdrev'))
			document.getElementById('prdrev').style.display =  '';
		if(document.getElementById('addreview'))
			document.getElementById('addreview').style.display = 'none';
		id1="WrtRev";
		if(document.getElementById('prdrev')){
			document.getElementById('tab1').className = 'prod-reviewbg-i';   
			document.getElementById('tab1').innerHTML = "<a href='#' class='graylink' onclick='displayreview(id1);return false;'>Additional info</a>";
			}
		if(document.getElementById('addreview')){
			document.getElementById('tab2').className = 'prod-reviewbg-a'; 
			document.getElementById('tab2').innerHTML = "Details"; 
		}
	}
}
function MailLinkFriend()
{
	var w = 500;
	var h = 490;
	
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	var page = site_url+"/SendLinkFriend.php?pro_url="+pro_url;
	windowprops = "height="+h+",width="+w+",top="+ wint +",left="+ winl +",location=no,"
					+ "scrollbars=yes,menubars=no,toolbars=no,resizable=no,status=no";
	window.open(page, "Popup", windowprops);
}

function Show_colors(attid, proid)
{	
	//get url of ajax file
	var url = ajax_url + "ajax_colorcombo.php";
	url = url + "?attid="+ escape(attid)+"&proid="+ escape(proid);
	http.open("GET", url, true);
	
	// alert(url);return false;
	
	http.onreadystatechange = getComboData;
    http.send(null);
}

function getComboData()
{
	if (http.readyState == 4)
	{
   		var xmlDocument = http.responseXML;
		var html = '';
		var totrec = xmlDocument.getElementsByTagName('no').item(0).firstChild.data;
		
		if(totrec != '0')
		{
			var count_loc = xmlDocument.getElementsByTagName('vcoloratt').length;
			html += '<select name="color_att" id="color_att" >';
			html += '<option value="0">&nbsp;Available Colors&nbsp;&nbsp;</option>';
			for(i = 0 ; i < count_loc ; i++)
			{
				var iProAttrId_table = xmlDocument.getElementsByTagName('iProAttrId').item(i).firstChild.data;
				var vOptions_table = xmlDocument.getElementsByTagName('vOptions').item(i).firstChild.data;
				html += '<option value="'+iProAttrId_table+'" >'+vOptions_table+'</option>';
			}
			html += '</select>';
		}
		if(document.getElementById('ajax_combo'))
			document.getElementById('ajax_combo').innerHTML = html;
	}
}
