function IsNumeric(sText) {
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;
    
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;   
}

function purchaseus() {

var urlstr = document.usform.url.value;

if ((document.usform.total.value == "")) {
	document.usform.errmessage.value = "Must Enter a Valid Visitor Amount"
	document.usform.errormes.value = ""
	document.usform.visitorno.value = 10000
}

if ((document.usform.total.value != "") && (urlstr.length < 9)) {
	document.usform.errmessage.value = "Please Enter Your URL"
}

if ((document.usform.total.value != "") && (document.usform.errormes.value == "") && (urlstr.length >= 9)) {
	document.usform.submit1.disabled = true;
	document.usform.submit1.value = ".:One Moment:.";
      var strurl = document.usform.url.value;
	strurl.toString();
	var newstrurl = strurl.replace(/\?/ig,'|qmark|');
      //document.usform.submit();  
      window.location="https://www.paypal.com/xclick/business=purchase%40traffictaxi.net&item_name="+document.usform.visitorno.value+"|Visitors|"+document.usform.cat.value+"&item_number="+newstrurl+"&amount="+document.usform.total.value+"&no_shipping=1&notify_url=http%3A//www.traffictaxi.net/cgi-bin/ipn.cgi&return=http%3A//www.traffictaxi.net/cgi-bin/completedpayment.cgi&cancel_return=http%3A//www.traffictaxi.net/order.html&no_note=1";

	}
}

function us() {

document.usform.total.value = "0";
document.usform.errmessage.value = "";

var visitors = document.usform.visitorno.value/1000;	
var visitorstr = visitors.toString();

if (visitorstr.indexOf(".") >= 0) {
	var visitorstrsplit = visitorstr.split(".");
		if (visitorstrsplit[1].length > 1) {
			document.usform.errormes.value = "Must Be Multiples of 100"
			document.usform.total.value = "";
			document.usform.errmessage.value = "";
		}
}

if ((document.usform.visitorno.value < 10000) && (document.usform.visitorno.value != "")) {	
	document.usform.errormes.value = "Min. Order is 10,000"
	document.usform.total.value = "";
	document.usform.errmessage.value = "";
}

if (document.usform.visitorno.value == 10000) {
	document.getElementById('us10').width = 10;
	document.getElementById('us10').height = 10;
}else{
	document.getElementById('us10').width = 8;
	document.getElementById('us10').height = 8;
}
if (document.usform.visitorno.value == 25000) {
	document.getElementById('us25').width = 10;
	document.getElementById('us25').height = 10;
}else{
	document.getElementById('us25').width = 8;
	document.getElementById('us25').height = 8;
}
if (document.usform.visitorno.value == 50000) {
	document.getElementById('us50').width = 10;
	document.getElementById('us50').height = 10;
}else{
	document.getElementById('us50').width = 8;
	document.getElementById('us50').height = 8;
}
if (document.usform.visitorno.value == 100000) {
	document.getElementById('us100').width = 10;
	document.getElementById('us100').height = 10;
}else{
	document.getElementById('us100').width = 8;
	document.getElementById('us100').height = 8;
}

if (document.usform.total.value != "") {
	var visitors = document.usform.visitorno.value/1000;	
	var tot = visitors * 3.5;
	var tot2 = Math.round(tot*100)/100;
	var tot2str = tot2.toString();
	var tot2search = tot2str.indexOf(".");
		if (tot2search == -1) {
			tot2 = tot2+".00"
		}else{
			var tot2split = tot2str.split(".");
			var tot2splitstr = tot2split[1].length;	
				if (tot2splitstr == 1) {
					tot2 = tot2+"0"
				}		
		}
	document.usform.errormes.value = ""
	document.usform.total.value = tot2;
		if (!IsNumeric(document.usform.visitorno.value)) {
			document.usform.errormes.value = "Amount Must Be Numberical"
			document.usform.total.value = "";
		}
	}
}

function purchaseuscat() {

var urlstr = document.uscatform.url.value;

if ((document.uscatform.total.value == "")) {
	document.uscatform.errmessage.value = "Must Enter a Valid Visitor Amount"
	document.uscatform.errormes.value = ""
	document.uscatform.visitorno.value = 10000
}

if ((document.uscatform.total.value != "") && (urlstr.length < 9)) {
	document.uscatform.errmessage.value = "Please Enter Your URL"
}

if ((document.uscatform.total.value != "") && (document.uscatform.errormes.value == "") && (urlstr.length >= 9)) {
	document.uscatform.submit1.disabled = true;
	document.uscatform.submit1.value = ".:One Moment:.";
      var strurl = document.uscatform.url.value;
	strurl.toString();
	var newstrurl = strurl.replace(/\?/ig,'|qmark|');
      //document.uscatform.submit();  
      window.location="https://www.paypal.com/xclick/business=purchase%40traffictaxi.net&item_name="+document.uscatform.visitorno.value+"|Visitors|"+document.uscatform.cat.value+"&item_number="+newstrurl+"&amount="+document.uscatform.total.value+"&no_shipping=1&notify_url=http%3A//www.traffictaxi.net/cgi-bin/ipn.cgi&return=http%3A//www.traffictaxi.net/cgi-bin/completedpayment.cgi&cancel_return=http%3A//www.traffictaxi.net/order.html&no_note=1";

	}
}

function uscat() {

document.uscatform.total.value = "0";
document.uscatform.errmessage.value = "";

var visitors = document.uscatform.visitorno.value/1000;	
var visitorstr = visitors.toString();

if (visitorstr.indexOf(".") >= 0) {
	var visitorstrsplit = visitorstr.split(".");
		if (visitorstrsplit[1].length > 1) {
			document.uscatform.errormes.value = "Must Be Multiples of 100"
			document.uscatform.total.value = "";
			document.uscatform.errmessage.value = "";
		}
}

if ((document.uscatform.visitorno.value < 10000) && (document.uscatform.visitorno.value != "")) {	
	document.uscatform.errormes.value = "Min. Order is 10,000"
	document.uscatform.total.value = "";
	document.uscatform.errmessage.value = "";
}

if (document.uscatform.visitorno.value == 10000) {
	document.getElementById('uscat10').width = 10;
	document.getElementById('uscat10').height = 10;
}else{
	document.getElementById('uscat10').width = 8;
	document.getElementById('uscat10').height = 8;
}
if (document.uscatform.visitorno.value == 25000) {
	document.getElementById('uscat25').width = 10;
	document.getElementById('uscat25').height = 10;
}else{
	document.getElementById('uscat25').width = 8;
	document.getElementById('uscat25').height = 8;
}
if (document.uscatform.visitorno.value == 50000) {
	document.getElementById('uscat50').width = 10;
	document.getElementById('uscat50').height = 10;
}else{
	document.getElementById('uscat50').width = 8;
	document.getElementById('uscat50').height = 8;
}
if (document.uscatform.visitorno.value == 100000) {
	document.getElementById('uscat100').width = 10;
	document.getElementById('uscat100').height = 10;
}else{
	document.getElementById('uscat100').width = 8;
	document.getElementById('uscat100').height = 8;
}

if (document.uscatform.total.value != "") {
	var visitors = document.uscatform.visitorno.value/1000;	
	var tot = visitors * 4;
	var tot2 = Math.round(tot*100)/100;
	var tot2str = tot2.toString();
	var tot2search = tot2str.indexOf(".");
		if (tot2search == -1) {
			tot2 = tot2+".00"
		}else{
			var tot2split = tot2str.split(".");
			var tot2splitstr = tot2split[1].length;	
				if (tot2splitstr == 1) {
					tot2 = tot2+"0"
				}		
		}
	document.uscatform.errormes.value = ""
	document.uscatform.total.value = tot2;
		if (!IsNumeric(document.uscatform.visitorno.value)) {
			document.uscatform.errormes.value = "Amount Must Be Numberical"
			document.uscatform.total.value = "";
		}
	}
}

function purchase() {

var urlstr = document.tarform.url.value;

if ((document.tarform.total.value == "")) {
	document.tarform.errmessage.value = "Must Enter a Valid Visitor Amount"
	document.tarform.errormes.value = ""
	document.tarform.visitorno.value = 10000
}

if ((document.tarform.total.value != "") && (urlstr.length < 9)) {
	document.tarform.errmessage.value = "Please Enter Your URL"
}

if ((document.tarform.total.value != "") && (document.tarform.errormes.value == "") && (urlstr.length >= 9)) {
	document.tarform.submit1.disabled = true;
	document.tarform.submit1.value = ".:One Moment:.";
	var strurl = document.tarform.url.value;
	strurl.toString();
	var newstrurl = strurl.replace(/\?/ig,'|qmark|');
      //document.tarform.submit();  
      window.location="https://www.paypal.com/xclick/business=purchase%40traffictaxi.net&item_name="+document.tarform.visitorno.value+"|Visitors|"+document.tarform.cat.value+"&item_number="+newstrurl+"&amount="+document.tarform.total.value+"&no_shipping=1&notify_url=http%3A//www.traffictaxi.net/cgi-bin/ipn.cgi&return=http%3A//www.traffictaxi.net/cgi-bin/completedpayment.cgi&cancel_return=http%3A//www.traffictaxi.net/order.html&no_note=1";

	}
}

function tar() {

document.tarform.total.value = "0";
document.tarform.errmessage.value = "";

var visitors = document.tarform.visitorno.value/1000;	
var visitorstr = visitors.toString();

if (visitorstr.indexOf(".") >= 0) {
	var visitorstrsplit = visitorstr.split(".");
		if (visitorstrsplit[1].length > 1) {
			document.tarform.errormes.value = "Must Be Multiples of 100"
			document.tarform.total.value = "";
			document.tarform.errmessage.value = "";
		}
}

if ((document.tarform.visitorno.value < 10000) && (document.tarform.visitorno.value != "")) {	
	document.tarform.errormes.value = "Min. Order is 10,000"
	document.tarform.total.value = "";
	document.tarform.errmessage.value = "";
}

if (document.tarform.visitorno.value == 10000) {
	document.getElementById('tar10').width = 10;
	document.getElementById('tar10').height = 10;
}else{
	document.getElementById('tar10').width = 8;
	document.getElementById('tar10').height = 8;
}
if (document.tarform.visitorno.value == 25000) {
	document.getElementById('tar25').width = 10;
	document.getElementById('tar25').height = 10;
}else{
	document.getElementById('tar25').width = 8;
	document.getElementById('tar25').height = 8;
}
if (document.tarform.visitorno.value == 50000) {
	document.getElementById('tar50').width = 10;
	document.getElementById('tar50').height = 10;
}else{
	document.getElementById('tar50').width = 8;
	document.getElementById('tar50').height = 8;
}
if (document.tarform.visitorno.value == 100000) {
	document.getElementById('tar100').width = 10;
	document.getElementById('tar100').height = 10;
}else{
	document.getElementById('tar100').width = 8;
	document.getElementById('tar100').height = 8;
}

if (document.tarform.total.value != "") {
	var visitors = document.tarform.visitorno.value/1000;	
	var tot = visitors * 2.5;
	var tot2 = Math.round(tot*100)/100;
	var tot2str = tot2.toString();
	var tot2search = tot2str.indexOf(".");
		if (tot2search == -1) {
			tot2 = tot2+".00"
		}else{
			var tot2split = tot2str.split(".");
			var tot2splitstr = tot2split[1].length;	
				if (tot2splitstr == 1) {
					tot2 = tot2+"0"
				}		
		}
	document.tarform.errormes.value = ""
	document.tarform.total.value = tot2;
		if (!IsNumeric(document.tarform.visitorno.value)) {
			document.tarform.errormes.value = "Amount Must Be Numberical"
			document.tarform.total.value = "";
		}
	}
}

function purchase2() {

var urlstr = document.untarform.url.value;

if ((document.untarform.total.value == "")) {
	document.untarform.errmessage.value = "Must Enter a Valid Visitor Amount"
	document.untarform.errormes.value = ""
	document.untarform.visitorno.value = 10000
}

if ((document.untarform.total.value != "") && (urlstr.length < 9)) {
	document.untarform.errmessage.value = "Please Enter Your URL"
}

if ((document.untarform.total.value != "") && (document.untarform.errormes.value == "") && (urlstr.length >= 9)) {
	document.untarform.submit1.disabled = true;
	document.untarform.submit1.value = ".:One Moment:.";
	var strurl = document.untarform.url.value;
	strurl.toString();
	var newstrurl = strurl.replace(/\?/ig,'|qmark|');
      //document.untarform.submit();
	window.location="https://www.paypal.com/xclick/business=purchase%40traffictaxi.net&item_name="+document.untarform.visitorno.value+"|Visitors|"+document.untarform.cat.value+"&item_number="+newstrurl+"&amount="+document.untarform.total.value+"&no_shipping=1&notify_url=http%3A//www.traffictaxi.net/cgi-bin/ipn.cgi&return=http%3A//www.traffictaxi.net/cgi-bin/completedpayment.cgi&cancel_return=http%3A//www.traffictaxi.net/order.html&no_note=1";
	}
}

function untar() {

document.untarform.total.value = "0";
document.untarform.errmessage.value = "";

var visitors = document.untarform.visitorno.value/1000;	
var visitorstr = visitors.toString();

if (visitorstr.indexOf(".") >= 0) {
	var visitorstrsplit = visitorstr.split(".");
		if (visitorstrsplit[1].length > 1) {
			document.untarform.errormes.value = "Must Be Multiples of 100"
			document.untarform.total.value = "";
			document.untarform.errmessage.value = "";
		}
}

if ((document.untarform.visitorno.value < 10000) && (document.untarform.visitorno.value != "")) {	
	document.untarform.errormes.value = "Min. Order is 10,000"
	document.untarform.total.value = "";
	document.untarform.errmessage.value = "";
}

if (document.untarform.visitorno.value == 10000) {
	document.getElementById('un10').width = 10;
	document.getElementById('un10').height = 10;
}else{
	document.getElementById('un10').width = 8;
	document.getElementById('un10').height = 8;
}
if (document.untarform.visitorno.value == 25000) {
	document.getElementById('un25').width = 10;
	document.getElementById('un25').height = 10;
}else{
	document.getElementById('un25').width = 8;
	document.getElementById('un25').height = 8;
}
if (document.untarform.visitorno.value == 50000) {
	document.getElementById('un50').width = 10;
	document.getElementById('un50').height = 10;
}else{
	document.getElementById('un50').width = 8;
	document.getElementById('un50').height = 8;
}
if (document.untarform.visitorno.value == 100000) {
	document.getElementById('un100').width = 10;
	document.getElementById('un100').height = 10;
}else{
	document.getElementById('un100').width = 8;
	document.getElementById('un100').height = 8;
}

if (document.untarform.total.value != "") {
	var visitors = document.untarform.visitorno.value/1000;	
	var tot = visitors * 2;
	var tot2 = Math.round(tot*100)/100;
	var tot2str = tot2.toString();
	var tot2search = tot2str.indexOf(".");
		if (tot2search == -1) {
			tot2 = tot2+".00"
		}else{
			var tot2split = tot2str.split(".");
			var tot2splitstr = tot2split[1].length;	
				if (tot2splitstr == 1) {
					tot2 = tot2+"0"
				}		
		}
	document.untarform.errormes.value = ""
	document.untarform.total.value = tot2;
		if (!IsNumeric(document.untarform.visitorno.value)) {
			document.untarform.errormes.value = "Amount Must Be Numberical"
			document.untarform.total.value = "";
		}
	}
}

function only_once(){
    document.supportform.submit1.disabled = true;
    document.supportform.submit();
}
function only_once1(){
    document.loginform.submit1.disabled = true;
    document.loginform.submit();
}
function change(){
document.getElementById("1").style.borderBottom = "1px solid #FFFFFF";
document.getElementById("1").style.backgroundColor = "#FFFFFF";
document.getElementById("1a").style.borderRight = "1px solid #000000";
document.getElementById("1b").style.borderLeft = "1px solid #000000";
}
function change_back(){
document.getElementById("1").style.borderBottom = "1px solid #000000";
document.getElementById("1").style.backgroundColor = "#cae3c6";
document.getElementById("1a").style.borderRight = "1px solid #cae3c6";
document.getElementById("1b").style.borderLeft = "1px solid #cae3c6";
}
function change2(){
document.getElementById("2").style.borderBottom = "1px solid #FFFFFF";
document.getElementById("2").style.backgroundColor = "#FFFFFF";
document.getElementById("2a").style.borderRight = "1px solid #000000";
document.getElementById("2b").style.borderLeft = "1px solid #000000";
}
function change_back2(){
document.getElementById("2").style.borderBottom = "1px solid #000000";
document.getElementById("2").style.backgroundColor = "#cae3c6";
document.getElementById("2a").style.borderRight = "1px solid #cae3c6";
document.getElementById("2b").style.borderLeft = "1px solid #cae3c6";
}
function change3(){
document.getElementById("3").style.borderBottom = "1px solid #FFFFFF";
document.getElementById("3").style.backgroundColor = "#FFFFFF";
document.getElementById("3a").style.borderRight = "1px solid #000000";
document.getElementById("3b").style.borderLeft = "1px solid #000000";
}
function change_back3(){
document.getElementById("3").style.borderBottom = "1px solid #000000";
document.getElementById("3").style.backgroundColor = "#cae3c6";
document.getElementById("3a").style.borderRight = "1px solid #cae3c6";
document.getElementById("3b").style.borderLeft = "1px solid #cae3c6";
}
function change4(){
document.getElementById("4").style.borderBottom = "1px solid #FFFFFF";
document.getElementById("4").style.backgroundColor = "#FFFFFF";
document.getElementById("4a").style.borderRight = "1px solid #000000";
document.getElementById("4b").style.borderLeft = "1px solid #000000";
}
function change_back4(){
document.getElementById("4").style.borderBottom = "1px solid #000000";
document.getElementById("4").style.backgroundColor = "#cae3c6";
document.getElementById("4a").style.borderRight = "1px solid #cae3c6";
document.getElementById("4b").style.borderLeft = "1px solid #cae3c6";
}
function change5(){
document.getElementById("5").style.borderBottom = "1px solid #FFFFFF";
document.getElementById("5").style.backgroundColor = "#FFFFFF";
document.getElementById("5a").style.borderRight = "1px solid #000000";
document.getElementById("5b").style.borderLeft = "1px solid #000000";
}
function change_back5(){
document.getElementById("5").style.borderBottom = "1px solid #000000";
document.getElementById("5").style.backgroundColor = "#cae3c6";
document.getElementById("5a").style.borderRight = "1px solid #cae3c6";
document.getElementById("5b").style.borderLeft = "1px solid #cae3c6";
}
function change6(){
document.getElementById("6").style.borderBottom = "1px solid #FFFFFF";
document.getElementById("6").style.backgroundColor = "#FFFFFF";
document.getElementById("6a").style.borderRight = "1px solid #000000";
document.getElementById("6b").style.borderLeft = "1px solid #000000";
}
function change_back6(){
document.getElementById("6").style.borderBottom = "1px solid #000000";
document.getElementById("6").style.backgroundColor = "#cae3c6";
document.getElementById("6a").style.borderRight = "1px solid #cae3c6";
document.getElementById("6b").style.borderLeft = "1px solid #cae3c6";
}
function change7(){
document.getElementById("7").style.borderBottom = "1px solid #FFFFFF";
document.getElementById("7").style.backgroundColor = "#FFFFFF";
document.getElementById("7a").style.borderRight = "1px solid #000000";
document.getElementById("7b").style.borderLeft = "1px solid #000000";
}
function change_back7(){
document.getElementById("7").style.borderBottom = "1px solid #000000";
document.getElementById("7").style.backgroundColor = "#cae3c6";
document.getElementById("7a").style.borderRight = "1px solid #cae3c6";
document.getElementById("7b").style.borderLeft = "1px solid #cae3c6";
}
