var __logo_height=16
var __logo_width=80


function loadJS(sName) {
var head = document.getElementsByTagName("head")[0];
   script = document.createElement('script');
   script.type = 'text/javascript';
   script.src = sName;
   head.appendChild(script);
}


function writeTextAds() {
	selectAdFormat();
	
	var textss = "<font family=\"arial\" face=\"Arial\"/>"
		+ "<div style=\"background-color:#" + click_yes_color_bg + ";border:1px solid #" + click_yes_color_border + ";width:" + click_yes_ad_width+ "px;height:" + click_yes_ad_height + "px\">"
		+ "<div style=\"width:100%;height:" + (click_yes_ad_height - __logo_height) + "px\">";
		while (__ad_count-- > 0) {
		 	 textss += writeTextAd();
		}

		textss += "</div>"
	    	 + "<div style=\"position:relative;left:"+ (click_yes_ad_width - __logo_width) +"px;\">"
		 + "<a href=\"http://www.sitesads.com/welcome/\"><img style=\"display: inline-block;\" border=0 src=\"http://www.sitesads.com/images/ads_"+click_yes_theme+".gif\"></a>"
		 + "</div></div></font>";

return textss;

}

function selectAdFormat() {
    switch(this.click_yes_theme) {
    case "black_g":
    case "black":
    click_yes_color_border = "FFFFFF";
    click_yes_color_bg = "FFFFFF";
    click_yes_color_link = "0000FF";
    click_yes_color_url = "008000";
    click_yes_color_text = "000000";
    break;
    case "pink_g":
    case "pink":
    click_yes_color_border = "FF00CC";
    click_yes_color_bg = "FFFFFF";
    click_yes_color_link = "0000FF";
    click_yes_color_url = "FF80FF";
    click_yes_color_text = "000000";
    break;
    case "white_g":
    case "white":
    click_yes_color_border = "0000FF";
    click_yes_color_bg = "FFFFFF";
    click_yes_color_link = "0000FF";
    click_yes_color_url = "008000";
    click_yes_color_text = "000000";
    break;
    default:
    click_yes_color_border = "0000FF";
    click_yes_color_bg = "FFFFFF";
    click_yes_color_link = "0000FF";
    click_yes_color_url = "008000";
    click_yes_color_text = "000000";
    
    }

    switch(this.click_yes_ad_format) {
    case "728x90":	
	__ad_width = 175;
	__ad_height = 65;
	__ad_count = 4;
	break;
    case "468x60":
	__ad_width = 233;
	__ad_height = 35;
	__ad_count = 2;
	break;
    case "125x125":
	__ad_width = 120;
	__ad_height = 105;
	__ad_count = 1;
	break
    case "234x60":
	__ad_width = 230;
	__ad_height = 35;
	__ad_count = 1;
	break;
    case "120x600":
	__ad_width = 100;
	__ad_height = 140;
	__ad_count = 4;
	break;
    case "160x600":
	__ad_width = 140;
	__ad_height = 110;
	__ad_count = 5
	break;
    case "180x150":
	__ad_width = 150;
	__ad_height = 130;
	__ad_count = 1;
	break;
    case "120x240":
	__ad_width = 100;
	__ad_height = 220;
	__ad_count = 1;
	break;
    case "200x200":
	__ad_width = 180;
	__ad_height = 90;
	__ad_count = 2;
	break;
    case "250x250":
	__ad_width = 230;
	__ad_height = 110;
	__ad_count = 2;
	break;
    case "300x250":
	__ad_width = 290;
	__ad_height = 55;
	__ad_count = 4;
	break;
    case "336x280":
	__ad_width = 320;
	__ad_height = 61;
	__ad_count = 4
	break;
    default :
	__ad_width = 200;
	__ad_height = 200;
	__ad_count = 1;

    }
}

function getTextAd() {
    return Math.round(Math.random() * (textLinks.length - 1)) ; 
}

function getImageAd() {
    return Math.round(Math.random() * (imageLinks.length - 1)) ; 
}


function goAd(adLink) {
    window.location=adLink;
}

function writeImageAd() {
    var adId = getImageAd();
    var link = "";
    var image = "";
    var alt = "";

    if (imageLinks[adId].length == 3) {
	alt = imageLinks[adId][0];
	image = imageLinks[adId][1];
	link = imageLinks[adId][2];

	document.write("<a href=\"" + link + "\"><img width=\"" + click_yes_ad_width + "\" height=\"" + click_yes_ad_height + "\" src=\"" + image + "\" alt=\"" + alt + "\"></a>");
    }

}

function writeTextAd() {
    var adId = getTextAd();
    var link = "";
    var url = "";
    var title = "";
    var text = "";

 

    if (textLinks[adId].length == 4) {
       title = textLinks[adId][0];
       text = textLinks[adId][1];
       url = textLinks[adId][2];
       link = textLinks[adId][3];
    } else if (textLinks[adId].length == 5) {
       title = textLinks[adId][0];
       text = textLinks[adId][1] ;
       if (__ad_height > 50) {
       text += " " + textLinks[adId][2];
       }
       url = textLinks[adId][3];
       link = textLinks[adId][4];
    }
    
    var textss = "<div style=\"float:left;margin:0px 0px;\" ><table style=\"width:" + __ad_width + "px;height:" + __ad_height + "px;table-layout:fixed;overflow:hidden\"><tr><td valign=\"top\" onClick=\"goAd(" + link + ")\"><a style=\"text-decoration:none;\" href=" + link + " target=" + click_yes_target + "> "
     + "<span style=\"text-decoration:underline;color: #" + click_yes_color_link + ";font-family:arial;font-size: 11px; font-weight:bold;\" >" + title + "</span><br>"
     + "<span style=\"text-decoration:none;color: #" + click_yes_color_text + ";font-family:arial;font-size: 10px;\">" + text + "</span>"
     + "<br><span style=\"text-decoration:none;color: #" + click_yes_color_url + ";font-family:arial;font-size: 10px;\">"+ url +"</span>"
     + "</a></td></tr></table></div>";
     
     return textss;
}


