var wapwindowc35, wapwindows35, wapwindowm35; // We only want one window for each phone

function wapc35(linken){
	if(document.layers || document.all || navigator.userAgent.indexOf("Mozilla/5")!=-1){
		var width = 180;
		var height = 505;
		var script = 'http://www.gelon.net/cgi-bin/wapc35.cgi';
		wapwindowc35 = window.open('','c35','width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
		wapwindowc35.document.write('<html><head><title>Siemens C35</title>');
		wapwindowc35.document.write('</head>');
		wapwindowc35.document.write('<body bgcolor="#FFFFFF"><font face="Arial" size="2">Connecting to service...<br><p>');
		wapwindowc35.document.write('</font>');
		wapwindowc35.document.write('</body></html>');
		wapwindowc35.document.close();
		if(document.layers){
			wapwindowc35.document.location = script+'?url='+linken;
		}
		else{
			wapwindowc35.document.location.replace(script+'?url='+linken);
		}
	}
	else{
		alert('Sorry!\nUnknown browser...\nCan\'t view the WAP sites.');
	}
}

function waps35(linken){
	if(document.layers || document.all || navigator.userAgent.indexOf("Mozilla/5")!=-1){
		var width = 180;
		var height = 447;
		var script = '/cgi-bin/waps35.cgi';
		wapwindows35 = window.open('','s35','width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
		wapwindows35.document.write('<html><head><title>Siemens S35</title>');
		wapwindows35.document.write('</head>');
		wapwindows35.document.write('<body bgcolor="#FFFFFF"><font face="Arial" size="2">Connecting to service...<br><p>');
		wapwindows35.document.write('</font>');
		wapwindows35.document.write('</body></html>');
		wapwindows35.document.close();
		if(document.layers){
			wapwindows35.document.location = script+'?url='+linken;
		}
		else{
			wapwindows35.document.location.replace(script+'?url='+linken);
		}
	}
	else{
		alert('Sorry!\nUnknown browser...\nCan\'t view the WAP sites.');
	}
}

function wapm35(linken){
	if(document.layers || document.all || navigator.userAgent.indexOf("Mozilla/5")!=-1){
		var width = 180;
		var height = 450;
		var script = '/cgi-bin/wapm35.cgi';
		wapwindowm35 = window.open('','m35','width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
		wapwindowm35.document.write('<html><head><title>Siemens M35</title>');
		wapwindowm35.document.write('</head>');
		wapwindowm35.document.write('<body bgcolor="#FFFFFF"><font face="Arial" size="2">Connecting to service...<br><p>');
		wapwindowm35.document.write('</font>');
		wapwindowm35.document.write('</body></html>');
		wapwindowm35.document.close();
		if(document.layers){
			wapwindowm35.document.location = script+'?url='+linken;
		}
		else{
			wapwindowm35.document.location.replace(script+'?url='+linken);
		}
	}
	else{
		alert('Sorry!\nUnknown browser...\nCan\'t view the WAP sites.');
	}
}


// Function for ensuring that the url typed in has a slash at the end.
// This only applies if url is a root domain...
function validateForm(){
	var field = document.forms[0].url.value;
	var ret = true;
	if(field.indexOf('/',7)==-1){
		ret = confirm('Missing trailing slash in URL!\n\nDo you want to add a trailing slash at the end of this URL?\nClick OK to add a slash and change the URL to '+field +'/ or\nCancel to continue without changes.');
		if(ret)document.forms[0].url.value += '/';
	}
	return ret;
}

