
        ////////////////////////////////////////////////////////////////////////////	
	window.onload=function(){
		
		// Round any corners
		$('.roundedDiv').corner({
		tl: { radius: 10 },
		tr: { radius: 10 },
		bl: { radius: 10 },
		br: { radius: 10 },
		antiAlias: true,
		autoPad: true,
		validTags: ["div"] });
		
		$('.roundedBottomDiv').corner({
		tl: { radius: 0 },
		tr: { radius: 0 },
		bl: { radius: 10 },
		br: { radius: 10 },
		antiAlias: true,
		autoPad: true,
		validTags: ["div"] });	
		
		$('.roundedTopDiv').corner({
		tl: { radius: 10 },
		tr: { radius: 10 },
		bl: { radius: 0 },
		br: { radius: 0 },
		antiAlias: true,
		autoPad: true,
		validTags: ["div"] });
		
		// Initialize all scrollable tables
		jQuery('.scrollable').Scrollable(350, 850);					

	}
        ////////////////////////////////////////////////////////////////////////////	
        
        
        ////////////////////////////////////////////////////////////////////////////
        function dictionary(term){
        	
        	// Definitions
        	var dict= new Array()
		dict["Display Url"]="A display url is used within your ad for display purposes only. This is usually just your website address. We use \"EngineSeeker.com\" in our ad."; 
        	dict["Destination Url"]="A destination url is the url that a user is taken to when clicking your ad. This can be your homepage or you can include a tracking url to track any conversions.";
        	dict["Site Summary"]="View unique visitor and page view totals.";
        	dict["Page Views"]="View a break-down of what pages your visitors visted most frequently.";
        	dict["Countries"]="View what countries your visitors are viewing your site from.";
        	dict["Web Browsers"]="View what web browsers your visitors are using.";
        	dict["Operating Systems"]="View what operating systems your visitors are using.";
        	dict["Display Settings"]="View what screen resolutions your visitors are using.";
        	dict["Alexa.com Thumbnail"]="This image is updated every week from Alexa.com. If this thumbnail does not match your site, please be patient and it will be updated during our next Alexa.com update.";
        	dict["How Do I Edit or Activate Keywords ?"]="Select the keywords below that you would like to perform an action on. Once you have checked off your keywords, click one of the buttons to the left to perform that specific action.";
        	dict["Ad Title"]="This is the most important part of your ad. Make sure you use words that relate to your website and catch the attention of your viewer.";
        	dict["Ad Description"]="Include a brief description of the products or services you are selling. Try to be creative, you are competing for this viewer's attention.";
        	dict["Ad Url"]="This is where the user is taken when they click on your Ad. This is usually just your homepage address.";
        	dict["Auto-Renew Keywords"]="We highly recommend that auto-renew is set to ON. This will prevent your competition from taking your keywords. Prior to activation you will be notified by email.";
        	dict["Auto-Renew Google Ad"]="When you enable Auto-Renew our system will automatically bill and reactivate your ad each month. You will get an email 7 days prior to the automated billing.";
        	dict["Credit Card Processing Limit"]="Please contact us as 1-888-617-8900 if you would like to order a product or service that exceeds $400.";
        	
        	// Set dictionary div
        	html='<div style="text-align:left;">';
        	html+='<h2 style="margin:0; padding-top:20px; padding-left:20px;">' + term + '</h2>';
        	html+='<p style="padding-left:20px; padding-right:20px; margin:0; padding-bottom:20px;">' + dict[term] + '</p>';
        	html+='</div>';
        	
        	
		overlib(html,RIGHT,OFFSETX,20,OFFSETY,10,SHADOW,SHADOWX,5,SHADOWY,5,FGCOLOR,'#fffdcf',BGCOLOR,'#000000',WIDTH,400);
        	
        }
        ////////////////////////////////////////////////////////////////////////////   
                
	  
        ////////////////////////////////////////////////////////////////////////////
        function loadPage(strURL, queryString, element) {
		// Do ajax request
		$.ajax({
			type: "POST",
			url: strURL,
			data: queryString,
			beforeSend: function(html){
				$(element).html('<div style="text-align:center;"><center><BR><BR><BR><BR><img src="/images/pleaseWait.gif" style="width:220px; height:19px; vertical-align: middle;"><br><b> Please Wait ... Do Not Refresh or Click Back</b></center></div>');
			},
			success: function(html){
				$(element).html(html);
			}
		});

        }
	////////////////////////////////////////////////////////////////////////////		
	
	
	////////////////////////////////////////////////////////////////////////////
	function submitForm(gForm, element) {
        	// generate query string
        	var queryString = $(gForm).serialize();
		// Load form into element
		loadPage('index.php', queryString, element);
	}
	////////////////////////////////////////////////////////////////////////////
		

	////////////////////////////////////////////////////////////////////////////	
	function redirect(location){
		window.location=location;
	}
	////////////////////////////////////////////////////////////////////////////	
	
	
	////////////////////////////////////////////////////////////////////////////
	function pop_window(url, width, height) {
	        //remove a attribute if you don't want it to show up
	        var popit = window.open(url,"",'scrollbars=1,width=' + width + ',height=' + height + ',top=0,left=0');
	}
	////////////////////////////////////////////////////////////////////////////
	
	
	
	////////////////////////////////////////////////////////////////////////////
	function fillIn(element, elementType){
	        var mlength=element.getAttribute? parseInt(element.getAttribute("maxlength")) : ""
	        if (element.getAttribute && element.value.length>mlength)
	        	element.value=element.value.substring(0,mlength)

		if(elementType == "title"){
                	if ($('adTemplateTitle'))
				document.getElementById('adTemplateTitle').innerHTML = element.value;
			document.getElementById('titleCharactersLeft').innerHTML = 30 - element.value.length;
		}
		else if(elementType == "adTitle"){
                	if ($('adTemplateTitle'))
				document.getElementById('adTemplateTitle').innerHTML = element.value;
			document.getElementById('titleCharactersLeft').innerHTML = 25 - element.value.length;
		}
		else if(elementType == "adTitleGoogle"){
                	if ($('adTemplateTitle'))
				document.getElementById('adTemplateTitle').innerHTML = element.value;
			document.getElementById('titleCharactersLeft').innerHTML = 35 - element.value.length;
		}		
		else if(elementType == "description"){
                	if ($('adTemplateDescription'))
				document.getElementById('adTemplateDescription').innerHTML = element.value;
			document.getElementById('descriptionCharactersLeft').innerHTML = 90 - element.value.length;
		}
		else if(elementType == "adDescription"){
                	if ($('adTemplateDescription'))
				document.getElementById('adTemplateDescription').innerHTML = element.value;
			document.getElementById('descriptionCharactersLeft').innerHTML = 70 - element.value.length;
		}
		else if(elementType == "description1"){
                	if ($('adTemplateDescription1'))
				document.getElementById('adTemplateDescription1').innerHTML = element.value;
			document.getElementById('description1CharactersLeft').innerHTML = 35 - element.value.length;
		}	
		else if(elementType == "description2"){
                	if ($('adTemplateDescription2'))
				document.getElementById('adTemplateDescription2').innerHTML = element.value;
			document.getElementById('description2CharactersLeft').innerHTML = 35 - element.value.length;
		}			
		else if(elementType == "url"){
			document.getElementById('adTemplateTitle').href = element.value;
			if(document.getElementById('urlCharactersLeft')){
				document.getElementById('urlCharactersLeft').innerHTML = 255 - element.value.length;
			}
		}
		else if(elementType == "displayUrl" || elementType == "adDisplayUrl"){
			document.getElementById('adTemplateDisplayUrl').innerHTML = element.value;
			document.getElementById('displayUrlCharactersLeft').innerHTML = 35 - element.value.length;
		}
		else if(elementType == "destinationUrl"){
			document.getElementById('adDestinationUrl').href = element.value;
			document.getElementById('destinationUrlCharactersLeft').innerHTML = 35 - element.value.length;
		}
	}
	////////////////////////////////////////////////////////////////////////////	
	
	////////////////////////////////////////////////////////////////////////////
        function highlightCell(cell, message) {
        	cell.style.background = "#e3f0ff";
               // if (message)
                	//overlib('<center><b>'+message+'</b></center>', BUBBLE, BUBBLETYPE, 'quotation', TEXTCOLOR, 'blue', TEXTSIZE, '12px');
        }
	////////////////////////////////////////////////////////////////////////////


	////////////////////////////////////////////////////////////////////////////
        function dehighlightCell(cell, out) {
                //nd();

                if (out != '')
                	cell.style.background = (out == 2) ? "white" : "white";
        }
	////////////////////////////////////////////////////////////////////////////
	
	
	////////////////////////////////////////////////////////////////////////////
	function formatAsMoney(mnt) {
		mnt -= 0;
		mnt = (Math.round(mnt*100))/100;
		return (mnt == Math.floor(mnt)) ? mnt + '.00'
		                : ( (mnt*10 == Math.floor(mnt*10)) ?
		                        mnt + '0' : mnt);
	}
	////////////////////////////////////////////////////////////////////////////	
	
	////////////////////////////////////////////////////////////////////////////
	function thickboxStart(url, width, height){
		
		// Set default values
		if(width==0){
			width=600;
		}
		if(height==0){
			height=330;
		}
	
		tb_show("",url + "&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=" + height + "&width=" + width +  "&modal=true","");							
	}
	////////////////////////////////////////////////////////////////////////////
	
	////////////////////////////////////////////////////////////////////////////
	function thickboxEnd(reloadParent){
		if(reloadParent!=false){
			self.parent.location.reload();
		}
		self.parent.tb_remove();
	}
	////////////////////////////////////////////////////////////////////////////
	
	
	////////////////////////////////////////////////////////////////////////////	
	function URLEncode(clearString) {
	  var output = '';
	  var x = 0;
	  clearString = clearString.toString();
	  var regex = /(^[a-zA-Z0-9_.]*)/;
	  while (x < clearString.length) {
	    var match = regex.exec(clearString.substr(x));
	    if (match != null && match.length > 1 && match[1] != '') {
	    	output += match[1];
	      x += match[1].length;
	    } else {
	      if (clearString[x] == ' ')
	        output += '+';
	      else {
	        var charCode = clearString.charCodeAt(x);
	        var hexVal = charCode.toString(16);
	        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
	      }
	      x++;
	    }
	  }
	  return output;
	}
	////////////////////////////////////////////////////////////////////////////
		
	
	////////////////////////////////////////////////////////////////////////////
	function URLDecode(encodedString) {
	  var output = encodedString;
	  var binVal, thisString;
	  var myregexp = /(%[^%]{2})/;
	  while ((match = myregexp.exec(output)) != null
	             && match.length > 1
	             && match[1] != '') {
	    binVal = parseInt(match[1].substr(1),16);
	    thisString = String.fromCharCode(binVal);
	    output = output.replace(match[1], thisString);
	  }
	  return output;
	}
	////////////////////////////////////////////////////////////////////////////
	
	
	////////////////////////////////////////////////////////////////////////////
	function displayHelp(){

		thickboxStart('index.php?controller=help');

	}
	////////////////////////////////////////////////////////////////////////////
	
