function GoToURL(j) {
  this.location.href = j;
}

function openDiv(obj) {
	var el = document.getElementById(obj);
	if (el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
		
}

function addSrcToDestList() {
	destList1 = window.document.forms[0].products2;
	srcList = window.document.forms[0].products1;
	var len = destList1.length;
		for(var i = 0; i < srcList.length; i++) {
		if ((srcList.options[i] != null) && (srcList.options[i].selected)) {
			//Check if this value already exist in the destList or not
			//if not then add it otherwise do not add it.
			var found = false;
			for(var count = 0; count < len; count++) {
				if (destList1.options[count] != null) {
					if (srcList.options[i].text == destList1.options[count].text) {
						found = true;
						break;
					}
				}
			}
			
			if (found != true) {
				destList1.options[len] = new Option(srcList.options[i].text, srcList.options[i].value);
				len++;
			}
		}
	}
}
	
	// Deletes from the destination list.
function deleteFromDestList() {
	var destList1 = window.document.forms[0].products2;
	var len = destList1.options.length;
	for(var i = (len-1); i >= 0; i--) {
		if ((destList1.options[i] != null) && (destList1.options[i].selected == true)) {
			destList1.options[i] = null;
		}
	}
}


function allSelect()
{
	List = document.forms[0].products2;
	if (List.length && List.options[0].value == 'temp') return;
		for (i=0;i<List.length;i++)
		{
			List.options[i].selected = true;
		}
}

function openDivOnly(obj) {
	var el = document.getElementById(obj);
	el.style.display = '';	
}
function closeDiv(obj) {
	var el = document.getElementById(obj);
	el.style.display = 'none';
}
function closeDivs(obj, obj1) {
	var el = document.getElementById(obj);
	var el1 = document.getElementById(obj1);
	el.style.display = 'none';
	el1.style.display = 'none';
}

var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
	XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
	XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
function getData(dataSource, divID)
{
	openDiv('fullscreen');
	openDiv(divID);
	
	if(XMLHttpRequestObject) {
	var obj = document.getElementById(divID);
	XMLHttpRequestObject.open("GET", dataSource);
	XMLHttpRequestObject.onreadystatechange = function()
	{
		if (XMLHttpRequestObject.readyState == 4 &&
			XMLHttpRequestObject.status == 200) {
			obj.innerHTML = XMLHttpRequestObject.responseText;
			}
		}
	XMLHttpRequestObject.send(null);
	}
}