﻿
var ReAjax = function()
{}
ReAjax.prototype.GetHttpRequest = function()
{
	var reObj="";
	if ( window.XMLHttpRequest ){
		reObj= new XMLHttpRequest() ;
	}
	else if ( window.ActiveXObject ){	
		try{
			reObj=new ActiveXObject("MsXml2.XmlHttp") ;
		}
		catch(e){
			reObj=new 	ActiveXObject("microsoft.XmlHttp")
		}
	}
	return reObj;
}

ReAjax.prototype.LoadUrl = function( urlToCall,altDiv)
{	
	var oReAjax = this ;
	var oAjaxHttp = this.GetHttpRequest() ;
	oAjaxHttp.open( "GET", urlToCall, true) ;
	oAjaxHttp.onreadystatechange=function()
	{
		if(oAjaxHttp.readyState==4)
		{
			document.getElementById(altDiv).style.display="none";
			document.getElementById(altDiv).innerHTML=oAjaxHttp.responseText;
		}
	}
	oAjaxHttp.send( null ) ;
}
ReAjax.prototype.LoadUrl2 = function( urlToCall)
{	
	var oReAjax = this ;
	var oAjaxHttp = this.GetHttpRequest() ;
	oAjaxHttp.open( "GET", urlToCall, false) ;
	oAjaxHttp.send( null );
	var result=oAjaxHttp.responseText;
	return result;
}

function GetAjaxStr(strurl)
{
	var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.open("Get",strurl,false);
	xmlhttp.send();
	var strret=unescape(xmlhttp.ResponseText);
	return strret;
}

function delcart(cid)
{
	var result=ReAjax.prototype.LoadUrl2(thispath+'include/menu.cfm?delteam='+cid);
	document.location.reload();
}
function changeCss(thisa)
{
	thisa.Class="";
}
var timestart;
var timeEnd;
function RightNow(t)
{
	if (t==1)
	{
		timestart = new Date();
	}
	else
	{
		timeEnd = new Date();
	}
}

function CalculateSpeed()
{
	
	RightNow(2);
	timeElapsed = (timeEnd - timestart)/1000 - 0.15;
	kbytes = 1024/timeElapsed;
	bits = kbytes * 1024 * 8;
	
	document.getElementById("speed").value=kbytes;
}

function getProductInfo(pid)
{	
	var obj = document.getElementById('ProductNameListID');
	while(obj.options.length>0)
	{
		obj.remove(0)
	}
	var opt = document.createElement("OPTION");
	opt.text = "---Please select the product---";
	opt.value = "0";
	obj.options.add(opt);
	opt.selected = true;
	var resultProductInfo = ReAjax.prototype.LoadUrl2("http://www.eveitem.com/include/fastorder.cfm?productID="+pid+"&isajax=1");
	var ProductInfoArray = resultProductInfo.split("@@@"); 
	for(i=0;i<ProductInfoArray.length-1;i++)
	{
			var ProductArray = ProductInfoArray[i].split("***");
			if(ProductArray.length>0)
			{
				var opt = document.createElement("OPTION");
				opt.value = ProductArray[0];
				opt.text = ProductArray[1];
				obj.options.add(opt);
			}
	}
}
function fastorderCheck()
{
	var objProductType = document.getElementById("ProductType");
	var objProductName = document.getElementById("ProductNameListID");
	if(objProductType.value==0)
	{
		alert("Please select the item.");
		return false;
	}
	if(objProductName.value==0)
	{
		alert("Please select the product.");
		return false;
	}
	document.getElementById('formfast').submit();
}