
function ShowBanner(strBannerCode, strBannerKeyword) {
    if ( strBannerKeyword.length != 0 ) {
        strBannerKeyword = escape(strBannerKeyword);
    }    
    switch ( strBannerCode) {
         case "150x200":         
            document.write("<iframe id=\"150x200banner\" name=\"150x200banner\" src=\"http://www.rexmag.com/includes/ads/150x200.asp\" framespacing=\"0\" frameborder=\"no\" scrolling=\"no\" width=\"150\" height=\"200\" allowtransparency=\"true\"></iframe>");
            break;
        case "728x90":
            document.write("<iframe id=\"728x90banner\" name=\"728x90banner\" src=\"http://www.rexmag.com/includes/ads/728x90.asp?strBannerKeyword=" + strBannerKeyword + "\" framespacing=\"0\" frameborder=\"no\" scrolling=\"no\" width=\"728\" height=\"90\" allowtransparency=\"true\"></iframe>");
            break;        
    }
}
function bookmarksite(title, url){
	if (document.all){
		window.external.AddFavorite(url, title);
	}else if (window.sidebar){
	    window.sidebar.addPanel(title, url, "")
	}else{
	    alert("Please hit Ctrl + D to Bookmark this page!");
	}
}

function dopopup(url, name, width, height)
{
	var left = (screen.width - width)/2;
	var top = (screen.height - height)/2;	
	newwin=window.open(url,name, 'width='+width+',height='+height+',top='+top+',left='+left+',directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
	if (window.focus) {newwin.focus()}
	return false;
}
function CountSiteOut(Code){
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				//alert("Your browser broke!");
				return false;
			}
		}
	}
	//count ajax hit
	var AjaxQueryString = "http://www.rexmag.com/ajax/countout.asp?code=" + Code;
	ajaxRequest.open("GET", AjaxQueryString, true);
	ajaxRequest.send(null); 
}
function DoSocialBookMark(WhichSite, ThisPage, ThisShortURL) {
	var ThisURL		= escape(document.location.href);
	var ThisTitle	= escape(document.title);
	var SubmitURL;
	switch (WhichSite) {
		case "delicious":
			SubmitURL = "http://del.icio.us/post?url=" + ThisURL + "&title=" + ThisTitle;
			break;
		case "digg":
			SubmitURL = "http://digg.com/submit?phase=2&url=" + ThisURL + "&title=" + ThisTitle;
			break;
		case "reddit":
			SubmitURL = "http://reddit.com/submit?url=" + ThisURL + "&title=" + ThisTitle;
			break;
		case "stumbleupon":
			SubmitURL = "http://www.stumbleupon.com/submit?url=" + ThisURL + "&title=" + ThisTitle;
			break;
		case "google":
			SubmitURL = "http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=" + ThisURL + "&title=" + ThisTitle;
			break;
		case "twitter":
			SubmitURL = "http://twitter.com/home?status=" + escape("Check Out " + ThisPage + " - " + ThisShortURL + " - on #RexTube!");
			break;
        case "tweetvid":            
            SubmitURL = "http://www.rextube.com/tweet-link.asp?t=" + escape(ThisPage) + "&u=" + ThisShortURL;
            break;
            
	}
	window.open(SubmitURL, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=850,resizable=yes,toolbar=no,location=no,status=no');
}

