// Generic Functions for TrendCall Website
// (C) Lex

function startup()
	{
	}


function setcookies(theReferrer) {
	// puts the nr of visits to this page in the last 30 days in a variable as well as the referring site (if applicable)
		
	// create an instance of the Date object
	var now = new Date();
	// fix the bug in Navigator 2.0, Macintosh
	fixDate(now);
	// cookie expires in 30 days 
	now.setTime(now.getTime() + 30 * 24 * 60 * 60 * 1000);
	var visits = getCookie("TrendCallCounter");
	var camefrom = getCookie("TrendCallCameFrom");
	// if the cookies were not found, this is your first visit
	if (!visits) {
		  visits = 1; // the value for the new cookie
		  camefrom = theReferrer; 
	  	  setCookie("TrendCallCameFrom", camefrom, now);
		} else {
		  // increment the counter
		  visits = parseInt(visits) + 1;
		}
	// set the new cookie
	setCookie("TrendCallCounter", visits, now);

}

function getParams() {
//Gets parapmeters from URL 

	var idx = document.URL.indexOf('?');
	var params = new Array();
	if (idx != -1) {
	var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
	for (var i=0; i<pairs.length; i++) {
		nameVal = pairs[i].split('=');
		params[nameVal[0]] = nameVal[1];
   		}
	}
	return params;
}

function submitForm(subscriptionType)
	{ 
		var okay	= true;
		if (okay == true) { okay = validateAgreement(); }
		if (okay == true) 
			{
				if (subscriptionType == 'Bank') 
					{
					document.myFormBank.submit();
					}
				else 
					{
					if (subscriptionType == 'PayPal') 
						{
						document.myFormPayPal.submit();
						}
					else
						{
						document.myFormGD.submit();
						}
					}

			}
	}
	

function init()
	{
		defaultStatus = "TrendCall Online Subscriptions";

		new popUp(300, 150, 300, 230, "Div1", "Please Close this window", "#E5F6F9", "#000066", "16pt serif", "TrendCall", "#00385c", "white", "lightgrey", "lightgrey", "black", false, true, true, true, false, false,'images/min.gif','images/max.gif','images/close.gif','images/resize.gif');
		
		return true;
	}
	
	
function addbookmark()
	{
	bookmarkurl="http://www.trendcall.nl"
	bookmarktitle="TrendCall Mobiel"
	if (document.all)
	window.external.AddFavorite(bookmarkurl,bookmarktitle)
	}

function validateAgreement()
	{
		if (document.myForm.agreement.checked == true) {
			return true;
		}
		else {
			alert ('\nOm je online aan te melden moet je aangeven dat je akkoord gaat \nmet onze Algemene Voorwaarden.\nZet hiervoor een vinkje in het betreffende hokje.\n\n\nKlik op OK om verder te gaan.\n');
			return false;
		}
	}
	

function disCharge()
	{
	explainImage.value=""
	explainImage.style.height=0
	explainImage.style.width=0
	}

function silentHandler()  
	{
	alert ('Nog even geduld, de pagina is nog niet geheel geladen');
	return true
	}

