function linkto(url)
{
	window.location=url;
}
function confirmModification()
{
	var val=document.orderdetails.pstatus.selectedIndex;
	if(val==1) {
		return confirm("Are you sure? This will assign the purchased resources to the User.");
	} else {
		return confirm("Are you sure to change the payment status?");
	}
}

function expandAll(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	} else {
		el.style.display = '';
	}
}

function expandedone(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	} else {
		el.style.display = '';
	}
}

function display(day, hour, minutes, seconds){
	// compose as seconds
	var time_remaining = seconds + (60*minutes) + (60*60*hour) + (24*60*60*day);

	// remove 1 second
	time_remaining -= 1;

	if (time_remaining <= 0) {
		if (document.counter) {
			document.counter.d2.value= "0d:0h:0m:0s";
		}
		return;
	}
	
	// break in to bits again
	day = Math.floor(time_remaining / (24 * 60 * 60));
	time_remaining = time_remaining % (24 * 60 * 60);
	// Calculate hours
	hour = Math.floor(time_remaining / (60 * 60));
	time_remaining = time_remaining % (60 * 60);
	// Calculate minutes
	minutes = Math.floor(time_remaining / 60);
	time_remaining = time_remaining % 60;
	

	if (document.counter) {	
		document.counter.d2.value=" "+day+"d:"+hour+"h:"+minutes+"m:"+time_remaining+"s";	
		setTimeout("display("+day+","+hour+","+minutes+","+time_remaining+")",1000); 
	}
}

function mailforabuse(mailurl, alertmsg)
{
	if(confirm(alertmsg)){
		window.location.href=(mailurl);
		return true;
	} else {
		return false;
	}
}

function subtotal(val, num)
{
	var val1=document.getElementById('qty_'+num).value;	
	document.getElementById('subtotal_'+num).value=val1* val;
	document.getElementById('totalcost').value=document.getElementById('totalcost').value-val+(val1* val);
}

var xmlHttp

function addtocartitem(url,tdid)
{
	xmlHttp=GetXmlHttpObjectRM()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}

	xmlHttp.onreadystatechange=function()
	{ 
		//alert(tdid);
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			document.getElementById(tdid).innerHTML=xmlHttp.responseText; 
		} 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function GetXmlHttpObjectRM()
{
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		//Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

