


	function CenterWindow(mypage,myname) {

		var w
		var h


		if (screen.width == 800) { w=650 }
		if (screen.width == 800) { h=395 }

		if (screen.width == 1024) { w=650 }
		if (screen.width == 1024) { h=395 }

		if (screen.width == 1280) { w=650 }
		if (screen.width == 1280) { h=395 }

		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;


		var settings ='height='+h+',';
		settings +='width='+w+',';
		settings +='top='+wint+',';
		settings +='left='+winl+',';
		settings +='scrollbars='+scroll+',';
		settings +='resizable=yes';
		win=window.open(mypage,myname,settings);

		if (parseInt(navigator.appVersion) >= 4) {
			win.window.focus();
		}
	}
	
/* popup */
/* top window */
	/*if (window != top) top.location.href = location.href;*/

/* no right click */

/*
	if (window.Event) // Only Netscape will have the CAPITAL E.
	document.captureEvents(Event.MOUSEUP); // catch the mouse up event
	function nocontextmenu()  // this function only applies to IE4, ignored otherwise.
	{
	event.cancelBubble = true
	event.returnValue = false;
	return false;
	}
	function norightclick(e) // This function is used by all others
	{
	if (window.Event) // again, IE or NAV?
	{
	if (e.which == 2 || e.which == 3)
	return false;
	}
	else
	if (event.button == 2 || event.button == 3)
	{
	event.cancelBubble = true
	event.returnValue = false;
	return false;
	}
	}
	document.oncontextmenu = nocontextmenu;  // for IE5+
	document.onmousedown = norightclick;  // for all others


	function addBookmark(title,url) {
	if (window.sidebar) {
	window.sidebar.addPanel(title, url,"");
	} else if( document.all ) {
	window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
	return true;
	}
	}
*/	
	
function adVisit(link) {
	
	if (!document.body) {
		return false;
	}
	
	var iframe = document.createElement('IFRAME');
	iframe.style.display = 'none';
	iframe.src = "http://www.babedirect.com/" + link;
	
	document.body.appendChild(iframe);
	
}	



function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }
    }
    return (arrReturnElements)
}


function processPlug ( ) {

	var linkTitle = getElementsByClassName(document.getElementById("dailyAdContainer"), "*", "ae_title_vert")[0].innerHTML;
	var linkURL   = getElementsByClassName(document.getElementById("dailyAdContainer"), "*", "ae_title_vert")[0].href;
	
	document.getElementById( "dailyAdLink2" ).innerHTML = linkTitle;
	document.getElementById( "dailyAdLink1" ).href = linkURL;
	document.getElementById( "dailyAdLink2" ).href = linkURL;
/*	document.getElementById( "dailyAdLink3" ).href = linkURL;*/

}

					
				
					

function randomBabe() {

	if (!document.body) {
		return false;
	}

	var iframe = document.createElement('IFRAME');
	iframe.style.display = 'none';
	iframe.src = "/addRandom.php?r=" + Math.floor ( Math.random ( ) * 10000000000 + 1 );
	document.body.appendChild(iframe);

}						

function goToURL ( link ) {
	window.location.href = link;
}


function isMaxChars( obj ){
	
	var maxChars=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	
	if (obj.getAttribute && obj.value.length>maxChars) {
		obj.value=obj.value.substring(0,maxChars)
	}
}
