function dl(url) 
{
	var newwindow = window.open(url,'download',
		'scrollbars=no,menubar=no,height=300,width=400,resizable=yes,toolbar=no,location=no,status=no');
	if (window.focus) {newwindow.focus();}

}

function toggle(set)
{
	count=0;
	ck = document.getElementById(set+count)
	while( ck)
	{
		ck.checked = !ck.checked;
		count++;
		ck = document.getElementById(set+count);
	}	
}

//GO1.1


///////////////////////////////////////
//
//  Generic onload by Brothercake
//  http://www.brothercake.com/
//
///////////////////////////////////////



//onload function
function generic()
{
	//
}



//setup onload function
if(typeof window.addEventListener != 'undefined')
{
	//.. gecko, safari, konqueror and standard
	window.addEventListener('load', generic, false);
}
else if(typeof document.addEventListener != 'undefined')
{
	//.. opera 7
	document.addEventListener('load', generic, false);
}
else if(typeof window.attachEvent != 'undefined')
{
	//.. win/ie
	window.attachEvent('onload', generic);
}

//** remove this condition to degrade older browsers
else
{
	//.. mac/ie5 and anything else that gets this far
	
	//if there's an existing onload function
	if(typeof window.onload == 'function')
	{
		//store it
		var existing = onload;
		
		//add new onload handler
		window.onload = function()
		{
			//call existing onload function
			existing();
			
			//call generic onload function
			generic();
		};
	}
	else
	{
		//setup onload function
		window.onload = generic;
	}
}


var secs
var timerID = null
var timerRunning = false
var delay = 1000
var url
function InitializeTimer(time,pg)
{
    // Set the length of the timer, in seconds
    secs = time
    url = pg
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        window.location = url;
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}

function CalculateTotal(row,products)
{
		prodElement = "productID_"+row;
		pObject = document.getElementById(prodElement);
		qObject = document.getElementById("quantity_"+row);
		tObject = document.getElementById("total_"+row);

		pID = parseInt(pObject.value);
		quantity = parseInt(qObject.value);
		
		
		if(pID==0 || quantity==0)
			return;
		
		pVal = products[pID];
		total = pVal * quantity;
		
		tObject.value = total;
}

function doNext(object, form) {
	if (object.name == "PHONEAREA") {
		if (object.value.length == 3) {
			form.PHONENUMBER1.focus();
		}
	}
	if (object.name == "PHONENUMBER1") {
		if (object.value.length == 3) {
			form.PHONENUMBER2.focus();
		}	
	}
}
