// JavaScript Document
//Set the s.prop for advertisers on information page
function track_advertisers(advertiser) {
	s=s_gi(s_account);
	s.linkTrackVars = "prop29";
	s.prop29 = advertiser;
	s.tl(this,'o',"Advertiser");
}

// will add target to external links
function externalLinks() {
	if (!document.getElementsByTagName){
		return;
	}
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") &&  anchor.getAttribute("rel") == "external"){
			anchor.target = "_blank"; 
		}
	}
} 
window.onload = externalLinks;

$(document).ready(function(){
   $('a').each(function () {
	var mylink = $(this).attr("href");
     if(typeof(mylink) != "undefined" && mylink.indexOf('compasscove.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=CConMBH");
		}
		else {
			$(this).attr("href","http://www.compasscove.com/?cmpid=CConMBH");
		}
	 }
	 else if (typeof(mylink) != "undefined" && mylink.indexOf('bayviewresort.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=BVonMBH");
		}
		else {
			$(this).attr("href","http://www.bayviewresort.com/?cmpid=BVonMBH");
		}
	 }
	 else if (typeof(mylink) != "undefined" && mylink.indexOf('dunesvillage.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=DVonMBH");
		}
		else {
			$(this).attr("href","http://www.dunesvillage.com/?cmpid=DVonMBH");
		}
	 }
	  else if (typeof(mylink) != "undefined" && mylink.indexOf('caribbeanresort.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=CBonMBH");
		}
		else {
			$(this).attr("href","http://www.caribbeanresort.com/?cmpid=CBonMBH");
		}
	 }
	 else if (typeof(mylink) != "undefined" && mylink.indexOf('longbayresort.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=LBonMBH");
		}
		else {
			$(this).attr("href","http://www.longbayresort.com/?cmpid=LBonMBH");
		}
	 }
	  else if (typeof(mylink) != "undefined" && mylink.indexOf('oceanreefmyrtlebeach.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=ORonMBH");
		}
		else {
			$(this).attr("href","http://www.oceanreefmyrtlebeach.com/?cmpid=ORonMBH");
		}
	 }
	 else if (typeof(mylink) != "undefined" && mylink.indexOf('breakers.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=BRonMBH");
		}
		else {
			$(this).attr("href","http://www.breakers.com/?cmpid=BRonMBH");
		}
	 }
	  else if (typeof(mylink) != "undefined" && mylink.indexOf('litchfieldbeach.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=LRonMBH");
		}
		else {
			$(this).attr("href","http://www.litchfieldbeach.com/?cmpid=LRonMBH");
		}
	 }
	 else if (typeof(mylink) != "undefined" && mylink.indexOf('montereybaysuites.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=MBonMBH");
		}
		else {
			$(this).attr("href","http://www.montereybaysuites.com/?cmpid=MBonMBH");
		}
	 }
	 else if (typeof(mylink) != "undefined" && mylink.indexOf('driftwoodlodge.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=DLonMBH");
		}
		else {
			$(this).attr("href","http://www.driftwoodlodge.com/?cmpid=DLonMBH");
		}
	 }
	 else if (typeof(mylink) != "undefined" && mylink.indexOf('paradiseresortmb.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=PRonMBH");
		}
		else {
			$(this).attr("href","http://www.paradiseresortmb.com/?cmpid=PRonMBH");
		}
	 }
	 else if (typeof(mylink) != "undefined" && mylink.indexOf('northbeachrentals.com') > 0){
		if(mylink.indexOf('?') > 0){
			$(this).attr("href",$(this).attr("href")+"&cmpid=NBonMBH");
		}
		else {
			$(this).attr("href","http://www.northbeachrentals.com/?cmpid=NBonMBH");
		}
	 }
	});
 });
