//window.document.write('Hello here hehe');

function testwrite(){
	var affstr=window.location.search.substring(1)
	if(affstr){
		alert(affstr);
		window.document.write('Hello here'+affstr);		
	}
}

/*
function call_aff(){
	var idnum = window.location.search.substring(1);
	var parts=customSplit(idnum,'&');
	affstr=parts[0];
	if(affstr.indexOf('=') == -1){
		if (affstr){
			//alert(idnum);
			document.write('<IMG border = "0" height = "1" width = "1" src="http://www.amazingwebproducts.com/ls/c.cgi/' + affstr + '">');
		}
	}
}
*/

function call_aff(){
	var idnum = window.location.search.substring(1);
	var parts=customSplit(idnum,'&');
	var aff_a='';
	affstr=parts[0];
	

	if(affstr.indexOf('=') == -1){
		if (affstr){
			//alert(affstr);
			document.write('<IMG border = "0" height = "1" width = "1" src="http://www.amazingwebproducts.com/ls/c.cgi/' + affstr + '">');
		}
	}else{
		for(i=0; parts.length > i; i++){
			if(parts[i].indexOf('a=')==0){				
				aff_a=customSplit(parts[i],'=');
				//alert(aff_a[1]);
				document.write('<IMG border = "0" height = "1" width = "1" src="http://www.amazingwebproducts.com/ls/c.cgi/' + aff_a[1] + '">');
			}
		}
	}
}


function customSplit(strvalue, separator){
	var n = 0;
	var temp;
	var separated = new Array();
	if (separator.length != 0) {
		while (strvalue.indexOf(separator) != -1) {
			temp = eval("arr"+n+" = strvalue.substring(0, strvalue.indexOf(separator));");
			separated[n]=temp;
			strvalue = strvalue.substring(strvalue.indexOf(separator)+separator.length, strvalue.length+1); 
			n++;
		}
		eval("arr" + n + " = strvalue;");
		arraySize = n+1;
		separated[n]=strvalue;
	}else { 
		for (var x = 0; x < strvalue.length; x++) {
		temp = eval("arr"+n+" = \"" + strvalue.substring(x, x+1) + "\";");
		separated[n]=temp;
		n++;
		}
		arraySize = n;
	}
	return separated;
}

function TimStatus(message)
{
    window.status=message;
}
function SetStatus(message)
{
    window.status=message;
    setTimeout('TimStatus("'+message+'")',1);
}
SetStatus(' ');