//captures the mouse x/y position at the time of an event, such as mouseover
var DHTML = (document.getElementById || document.all || document.layers);
var debug = false;
var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1)
var posx = 0;
var posy = 0;


function formHandler(form){
	var URL = document.form.site.options[document.form.site.selectedIndex].value;
	window.location.href = URL;
}
function skinSubscribe(memstat){
	if ((document.eform.email.value == "") || (document.eform.email.value =="e-mail address")  || (document.eform.email.value.indexOf("@") == -1) || (document.eform.email.value.indexOf(" ") > -1) ) {
		alert("Please enter a valid e-mail address.");
	}
	else {
		window.open("http://www.mrskinmail.com/enroller.php?email="+document.eform.email.value+"&memstat="+memstat,"subscribe_win","height=300,width=300,scrollbars=no");
	}
}
function skinSubscribe2(memstat){
	if ((document.eform2.email.value == "") || (document.eform2.email.value =="e-mail address")  || (document.eform2.email.value.indexOf("@") == -1) || (document.eform2.email.value.indexOf(" ") > -1) ) {
		alert("Please enter a valid e-mail address.");
	}
	else {
		window.open("http://www.mrskinmail.com/enroller.php?email="+document.eform2.email.value+"&memstat="+memstat,"subscribe_win","height=300,width=300,scrollbars=no");
	}
}
//stay jump determines if the div will jump if mouse is near the bottom of the browser window.
function episDivPos(e,jump)
{
        if (!e){var e = window.event;}
        if (e.pageX || e.pageY)
        {
                posx = e.pageX;
                posy = e.pageY;
		if(jump == 1)
		{
                var winHeight = window.innerHeight;
				var shift = window.scrollY;
				if((winHeight + shift) - posy <= 150){posy = posy - 170;}
		}
        }
        else if (e.clientX || e.clientY)
        {
                posx = e.clientX;
                posy = e.clientY;
                if (isIE)
                {
                	if(document.documentElement && document.documentElement.scrollTop)
                	{
				posx += document.documentElement.scrollLeft;
                        	posy += document.documentElement.scrollTop;
                                if(jump == 1)
                                {
                                        var winHeight = document.documentElement.clientHeight;
                                        var shift = document.documentElement.scrollTop;
                                        if((winHeight + shift) - posy <= 150){posy = posy - 170;}
                                }
			}
			else if(document.body)
			{
 				posx += document.body.scrollLeft;
                        	posy += document.body.scrollTop;
				if(jump == 1)
				{
                			var winHeight = document.body.clientHeight;
					var shift = document.body.scrollTop;
					if((winHeight + shift) - posy <= 150){posy = posy - 170;}
				}
			}	
                }
        }
}
 function changeImgSrc(id,swap)
 {
        if (!DHTML) return;
        var x = new getObj(id);
        if(document.all || document.getElementById)
        {
                string = x.obj.src;
                strLength = string.length;         
                fileType = string.substring(strLength - 4,strLength);
                fileLoca = string.substring(0,strLength - 5);
                x.obj.src = fileLoca+swap+fileType;
        }
 }
function changeWordSrc(id,swap)
{
	if (!DHTML) return;
	var x = new getObj(id);
	if(document.all || document.getElementById)
	{
		x.obj.src = swap;
	}

}
function clipImgShow(flag,DivID,thumb)  
  {
       var thumbnail = new Image();
       if (!DHTML) return;
       var x = new getObj(DivID);
       if(document.all || document.getElementById){document.clipthumbnail.src = thumb;}
       x.style.top=(posy + 10) + 'px';
       x.style.left=(posx +15) + 'px';
       x.style.visibility = (flag) ? 'hidden' : 'visible';
}
function thumbImgShow(flag,DivID,thumb)
  {
       var thumbnail = new Image();
       if (!DHTML) return;
       var x = new getObj(DivID);
       if(document.all || document.getElementById){document.thumbnail.src = thumb;}
       x.style.top=(posy + 10) + 'px';
       x.style.left=(posx +15) + 'px';
       x.style.visibility = (flag) ? 'hidden' : 'visible';
}
function thumbHeadImgShow(flag,DivID,thumb)
  {
       var thumbnail = new Image();
       if (!DHTML) return;
       var x = new getObj(DivID);
       if(document.all || document.getElementById){document.thumbnailhead.src = thumb;}
       x.style.top=(posy + 10) + 'px';
       x.style.left=(posx +15) + 'px';
       x.style.visibility = (flag) ? 'hidden' : 'visible';
}

function msmImgShow(flag,DivID,thumb)
  {
       var thumbnail = new Image();
       if (!DHTML) return;
       var x = new getObj(DivID);
       if(document.all || document.getElementById){document.rateImage.src = thumb;}
       x.style.top=(posy - 95) + 'px';
       x.style.left=(posx +15) + 'px';
       x.style.visibility = (flag) ? 'hidden' : 'visible';
}
function choosePopup(extlink){
        if (typeof extlink != "undefined")
        {
                imdb = extlink.indexOf('imdb');
                amazon = extlink.indexOf('amazon');
                if (imdb > -1)
                {
                        msmImgShow(false,"ratingPop","/images/msm/imdb_balloon.gif");
                }
                else if (amazon > -1)
                {
                        msmImgShow(false,"ratingPop","/images/msm/amazon_balloon.gif");
                }
		else
		{
			return false;
		}
        }
}
function loadFromSelect(myId,myType){
        document.location.href = "/msm.htm?type="+myType+"&id="+myId;
}
function toggleTrophyCase()
{
	if (!DHTML) return;

	var x = new getObj("trophyDiv");
	if(x.style.visibility == 'visible' || x.style.visibility == 'show'){flag = true;}else{flag = false;}
       	x.style.visibility = (flag) ? "hidden" : "visible";
}
/*function toggleTrophyCase()
{
	if (!DHTML) return;

	var x = new getObj("trophyDiv");
	if(x.style.visibility == 'visible' || x.style.visibility == 'show'){flag = true;}else{flag = false;}
       	x.style.visibility = (flag) ? "hidden" : "visible";
      	posy = posy+10;
       	posy = posy+"px";
       	x.style.top=posy;
      	posx = posx-10;
       	posx = posx+"px";
       	x.style.left=posx;
}*/
/*the parameters of this function are as follows: 
i = the tab and div to be affected
numtabs = the number of tabs on the div. this limits the for loop
tabDiv = the prefix of the div ID this combined with the i var gives you the name of the id to affect.
*/
function displayTab(i,numTabs,tabDiv)
{
	if(!DHTML) return;
	for (f=1;f<numTabs+1;f++)
	{
			var x = new getObj(tabDiv+f);
			x.style.display = 'none';	
	}
	var x = new getObj(tabDiv+i);
	x.style.display = 'block';
}
function showRatingPop(flag,DivID,rating)
{
        var rateImage = new Image();
        var rimg = "/images/definitionBalls/act_"+rating+"_ball.gif";
	if (!DHTML) return;
        var x = new getObj(DivID);
        if(document.all || document.getElementById)
        {
                document.rateImage.src = rimg;
        }
        x.style.visibility = (flag) ? 'hidden' : 'visible';
    	posx = posx-220;
        posx = posx+"px";
    	posy = posy-20;
        posy = posy+"px";
        x.style.top=posy;
	x.style.left=posx;
}
function showMovieRatingPop(flag,DivID,rating)
{
        var rateImage = new Image();
        var rimg = "/images/movbio/imx/skinrate_"+rating+"_ball.gif";
        if (!DHTML) return;
        var x = new getObj(DivID);
        if(document.all || document.getElementById)
        {
                document.rateImage.src = rimg;
        }
        x.style.visibility = (flag) ? 'hidden' : 'visible';
        posx = posx+20;
        posx = posx+"px";
        posy = posy-20;
        posy = posy+"px";
        x.style.top=posy;
        x.style.left=posx;
}


var pluginlist;
var agt=navigator.userAgent.toLowerCase();
var ie  = (agt.indexOf("msie") != -1);
var ns  = (navigator.appName.indexOf("Netscape") != -1);
var windows = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
var mac = (agt.indexOf("mac")!=-1);
if (ie && windows) {
	pluginlist = detectIE("Adobe.SVGCtl","SVG Viewer") + detectIE("SWCtl.SWCtl.1","Shockwave Director") + detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer") + detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player") + detectIE("PDF.PdfCtrl.5","Acrobat Reader"); }

if (ns || !windows) {
		nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();
		pluginlist = detectNS("image/svg-xml","SVG Viewer") + detectNS("application/x-director","Shockwave Director") + detectNS("application/x-shockwave-flash","Shockwave Flash") + detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + detectNS("video/quicktime","QuickTime") + detectNS("application/x-mplayer2","Windows Media Player") + detectNS("application/pdf","Acrobat Reader"); 
}

function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n'); if (result) return name+','; else return ''; }
function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }
pluginlist += navigator.javaEnabled() ? "Java," : "";

if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function setCookieTempPref(name, value, expires, path, domain, secure)
{
        var curCookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
        document.cookie = curCookie;
}
function setSkinPref(DivID)
{
        var name = 'skinPref2';
        var pref = document.cookie;
        var isThereFirst = pref.indexOf(name);
        var exp = new Date();
        var tenYears = exp.getTime() + (10 * 365* 24 * 60 * 60 * 1000);
        exp.setTime(tenYears);
        if (!DHTML) return;
        var x = new getObj(DivID);
        x.style.visibility = 'hidden';
        setCookieTempPref(name,DivID,exp,'/','');
}
function getCookieTemp(name)
{
	if(!document.layers)
	{
		var cookies = document.cookie;
		if (cookies.indexOf(name) != -1)
		{
			var startpos = cookies.indexOf(name)+name.length+1;
			var endpos = cookies.indexOf(";",startpos);
			if (endpos == -1) endpos = cookies.length;
			var DivID = unescape(cookies.substring(startpos,endpos));
			hideSearch();
			showSearch(DivID);
		}else{
			setSkinPref('actressSearch');
			showSearch('actressSearch')
		}
	}
}
function joinPop(i){
var windowprops = "toolbar=0,location=0,directories=0,status=0, " +
"menubar=0,scrollbars=1,resizable=1,width=780,height=520";
var testvar = "popunder";
var pageto = "http://www.mrskin.com/join/ccjoin.html?mes="+i;
OpenWindow = window.open(pageto, "popup", windowprops);
OpenWindow.focus();
}
function tradePop(){
var windowprops = "toolbar=0,location=0,directories=0,status=0, " +
"menubar=0,scrollbars=1,resizable=1,width=670,height=520";
var pageto = "http://www.mrskin.com/trademarks.htm";
OpenWindow = window.open(pageto, "trademarks", windowprops);
OpenWindow.focus();
}

function getQueryVariable(variable)
{
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++)
                {
                var pair = vars[i].split("=");
                if (pair[0] == variable)
                {
                        return pair[1];
                }
        }
}
function initWhatsNew(page){
	load = getQueryVariable(page);
	if(load == "hot"){
		changeWhatsNew("hotupdates");
	}
}
function skinterviewPop(imageLocation)
{
	var windowprops = "toolbar=0,location=0,directories=0,status=0, " +
	"menubar=0,scrollbars=1,resizable=1,width=600,height=535";
	var testvar = "popunder";
	var pageto = "/skinterviewpop.html?img="+imageLocation;
	OpenWindow = window.open(pageto, "popup", windowprops);
	OpenWindow.focus();
}
function getSkinterviewPic()
{
	var location = getQueryVariable("img");
	var x = new getObj("skinterviewPicture");
	x.obj.src = location;
}
function getSpeedWM(){
        if(document.cookie){
                var index = document.cookie.indexOf("playerpref");
                if (index!=-1){
                        namestart=(document.cookie.indexOf("=",index)+1);
                        nameend=document.cookie.indexOf(";",index);
                        if (nameend == -1){nameend=document.cookie.length;}
                        speed=document.cookie.substring(namestart,nameend);
                        return speed;
                }
        }
        else{
                return false;
        }
}
function winOpenWM(clipobj,player)
{
        var clipstr = "&title="+escape(clipobj["jtitle"])+"&star="+escape(clipobj["starname"]);
        if(player == 1)
        {
                var mywin = "/marquee.htm?type=quick&mov="+clipobj["qtclipid"]+clipstr;
        }
        else if(player == 0)
        {
                var mywin = "/marquee.htm?type=windows_hi&mov="+clipobj["wmvlocation_high"]+clipstr;
        }
        else if(player == 2)
        {
                var mywin = "/marquee.htm?type=windows_lo&mov="+clipobj["wmvlocation_low"]+clipstr;
        }
        window.open(mywin,"player","width=720,height=473");
}
function launchPlayerWM(arr)
{
        var cookie_speed = getSpeedWM();
	if(cookie_speed >= 0){
                winOpenWM(cliparr[arr],cookie_speed);
	}
        else if(document.cookie.indexOf('playerpref') == -1)
        {
                mywin = window.open('/prefwm.html?qt='+cliparr[arr]["qtclipid"]+'&title='+cliparr[arr]["jtitle"]+'&star='+cliparr[arr]["starname"]+'&winlow='+cliparr[arr]["wmvlocation_low"]+'&winhigh='+cliparr[arr]["wmvlocation_high"]+'','prefs','width=500,height=360,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1');

		mywin.focus();
        }
}
function getSpeed(){
        if(document.cookie){
                var index = document.cookie.indexOf("uparms");
                if (index!=-1){
                        namestart=(document.cookie.indexOf("=",index)+1);
                        nameend=document.cookie.indexOf(";",index);
                        if (nameend == -1){nameend=document.cookie.length;}
                        speed=document.cookie.substring(namestart,nameend);
                        return speed;
                }
        }
        else{
                return false;
        }
}
function winOpen(clipobj,player)
{
        var clipstr = "&title="+escape(clipobj["jtitle"])+"&star="+escape(clipobj["starname"]);
        if(player == 1)
        {
                var mywin = "/marquee_rm.htm?type=quick&mov="+clipobj["qtclipid"]+clipstr;
        }
        else if(player == 0)
        {
                var mywin = "/marquee_rm.htm?type=real&mov="+clipobj["rmlocation"]+clipstr;
        }
        window.open(mywin,"player","width=720,height=473");
}
function launchPlayer(arr)
{
        var funtime = getSpeed();
        if(funtime==1)
        {
                winOpen(cliparr[arr],1);
        }
        else if(funtime==0)
        {
                winOpen(cliparr[arr],0);
        }
        else if(document.cookie.indexOf('uparms') == -1)
        {
                window.open('/pref.html?qt='+cliparr[arr]["qtclipid"]+'&title='+cliparr[arr]["jtitle"]+'&star='+cliparr[arr]["starname"]+'&rm='+cliparr[arr]["rmlocation"]+'','prefs','width=423,height=300,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
        }
}
