/*
 *
 * Setup Tracking for inbound Google Traffic for later form use:
 * Wed Aug 19, 2009
 *
 */

function getgetvar( name ){
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function setCookie(c_name,value,expiredays) {
  var exdate=new Date();
  exdate.setDate(exdate.getDate()+expiredays);
  document.cookie=c_name+ "=" +escape(value)+
  ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

/*  
 * Track sourcecode GET parameter, set cookie to remember it! 
*/
var sourcecode = getgetvar("sourcecode");
if (sourcecode.length>0) {
  setCookie('sourcecode',sourcecode,365);
}

