// JavaScript Document

/**
	Function to get elecmentById
*/

function $(elementId)
{
	return document.getElementById(elementId);
}

/**
	takes an select element id and return selected index value use with combo box
*/
function getSelectedValue(strElementId)
{
	var obj = $(strElementId);
	var selectedIndex = obj.selectedIndex;
	return obj.options[selectedIndex].value;
}

/**
	function hide element takes an id of element
*/
function hideElement(strElementId)
{
//	alert($(strElementId));
	$(strElementId).style.display = "none";
}

/**
	fucntion viewRow display a row hidden row
*/
function viewRow(strElementId)
{
	$(strElementId).style.display = "table-row";

}

function setVisible(value, emlementId)
{
	$(emlementId).style.visibility = value;
}


/**
*	function return http req object
*/
function getHttpReq()
{
	var httpReq;

	if(window.XMLHttpRequest)
	{
		httpReq = new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
		httpReq = new ActiveXObject("Microsoft.XMLHTTP");
		try {

			httpReq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				httpReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	return httpReq;
}


/**
*/
function viewAjaxData(sourceURL, destinationElement)
{
	//get http req objet
	var httpReq = getHttpReq();
	$('container_popup').style.display = "block";
	//alert($('bs_product_detail').style.display );
	httpReq.open('GET', sourceURL, true);
	httpReq.onreadystatechange = function (){showAjaxData(httpReq, destinationElement)};
	httpReq.send("");
}

function showAjaxData(httpReq, destinationElement)
{
	if(httpReq.readyState == 4 && httpReq.status == 200)
	{
		$(destinationElement).innerHTML = httpReq.responseText;
	}
	else
	{
		$(destinationElement).innerHTML = "Loading...";
	}
}

