
//function used on the suggestions link on top of page.
function suggestionsWindow() {
	var suggestionWindow = window.open('/feedback.html','Feedback','width=976,height=600,scrollbars=no,toolbar=no,menubar=no',true);
	suggestionWindow.focus();
	return false;
}

//function used for java navigation popup window
function navigateUrl(the_img_name) {
	window.open('http://www.intuitwebsites.com/~gallery/templates/'+the_img_name+'/index.html',the_img_name,'width=800,height=600,left=100,top=100,scrollbars=yes,resizable=yes',true); 		
}

//functions used to show the popup div and close it.
function openSesame(theDivId) {
	
	//hide all popup layers and show the one selected.
	$("div#hiddenLayers div").fadeOut("slow");
	$('#'+theDivId).fadeIn("slow");
	
	//round the corners of the popup div
	$('#'+theDivId).corner("10px");
	
	return false;

}

function closeSesame(theDivId) {
	
	//hide the layer showing
	$('#'+theDivId).fadeOut("slow");
	return false;
	
}

function fixString(param, value, re, str){
	var parval = param + '=' + value;
	if(str != "#"){ //no need to append to just #
		if(str.toLowerCase().indexOf(param.toLowerCase()) > -1){ // handle if param already exists
			str = str.replace(re, parval);
		} else if (str.indexOf('-code-') > -1) {
			str = str.replace('-code-', value);
		} else{
			var delim = '?';
			if(str.indexOf(delim) > -1)
				delim = '&';
			if(str.indexOf('#') > -1){ // if fragment identifier exists
				str = str.replace(/#/, delim + parval + '#');
			}else{
				str += delim + parval;
			}
		}
	}
	return str;
}


$(document).ready(function() {
	
	//home page boxes
	$("div.homePod").corner("10px");
	$("div.homeRound").corner("5px");
	$("div.homeRound div.otherProducts").corner("4px");
	
	//round corners of content box with blue top and white background
	$("div.webAdContent").corner("10px");
   	
	//round the corners of the box in the hero section of the websites section
	$("div.round").corner("10px"); //round the outside corner
	$("div.round  p").corner("8px"); //round the inside corners
	
	$("div.roundSell").corner("10px");
	$("div#sellProduct").corner("8px");
	
	$("div.tabContent").corner("bl br 8px");
	
	//websites -> do it yourself let us design box.
	//$("div#roundManBox").corner("bl br 10px");
	//$("div#roundManBox").corner("tl tr 9px");
	$("div#roundManBox").corner("6px");
	$("div#letUsPod").corner("5px");

	var domain = window.location.href.split('/')[2];
	$('a[href^=http://], a[href^=https://]').filter('a:not([href*="'+domain+'"])').each(function(){
		$(this).click(function(e){
			var page = this.href.replace(/(^http:\/\/)|(^https:\/\/)/i, '/outbound/');
			pageTracker._trackPageview(page);
		});
	});
	
	if (mtcTrackingCode.length > 0) {
		var param = 'AFFILIATEINFO';
		var value = mtcTrackingCode;
		var re = /AFFILIATEINFO=[^&#]*/i;
		var parval = param + '=' + value;

		$('a').each(function(){ //iterate through each link on the page
			this.href = fixString(param, value, re, this.href);						
		});
	}
	
});