//###### anchorPreview
function anchorPreview()
{ var winH = $(window).height();
	var ancP = $("#anchorPreview").position();
  $(window).scrollTop(Math.max(0, ancP.top-winH-1)+1);
}

/*************************************/
//        jquery ready
/*************************************/
$(document).ready(function(){   

  //###### pop_more
  var pop_more = new eZpopup(436, 'auto', 0);
  pop_more.setContentOverflow('','')
  pop_more.showHandle  = false;
  pop_more.baseZIndex  = 100;
  pop_more.contentKeep = true;
  pop_more.content = popMoreContent;
  pop_more.background = '#FFFFCC';
  pop_more.handleOpacity = 0.6;
  pop_more.frameOpacity  = 0.6;
  pop_more.create();

  var popMoreTimerId     = 0;
  var popMoreTimerStanby = 300;
  popMoreShow = function(posX, posY)
  { pop_more.slideDown('normal', posX, posY);
  }
  var popMoreHide = function(){
    clearTimeout(popMoreTimerId);
  	pop_more.fadeOut('fast');
  }

  $("#area_tspc_more").mouseover(function(e){
    clearTimeout(popMoreTimerId);
    var thisW   = $("#img_tspc_more").width();
    var thisH   = $("#img_tspc_more").height();
    var thisPos = $("#img_tspc_more").position();
    var popW    = $(pop_more.ezpopWindow).width();

    popMoreTimerId = setTimeout("popMoreShow("+(thisPos.left+thisW-popW)+","+(thisPos.top+thisH+3)+")", popMoreTimerStanby);
  }).mouseout(function(e){
    popMoreHide();
  });
  $("#img_menu_specials").mouseover(function(e){
    clearTimeout(popMoreTimerId);
    var thisW   = $(this).width();
    var thisH   = $(this).height();
    var thisPos = $(this).position();
    var scrY    = $(window).scrollTop();
    var popW    = $(pop_more.ezpopWindow).width();
    var popH    = $(pop_more.ezpopWindow).height();

    var popY    = thisPos.top-popH-3 > $(window).scrollTop() ? thisPos.top-popH-3 : thisPos.top+thisH+3;
    popMoreTimerId = setTimeout("popMoreShow("+(thisPos.left+thisW-popW)+","+popY+")", popMoreTimerStanby);
  }).mouseout(function(e){
    popMoreHide();
  });

  //###### pop_star
  var pop_star = new eZpopup();
  pop_star.setContentOverflow('hidden','hidden');
  pop_star.showHandle  = false;
  pop_star.baseZIndex  = 100;
  pop_star.contentKeep = true;
  pop_star.background  = 'transparent';
  pop_star.handleOpacity = 0.38;
  pop_star.frameOpacity  = 0.38;
  pop_star.content       = '<div id="pop_star_div" style="border:solid #343434 1px;background-color:#EAF1F9;background-image:url(/images/v2/icons/mozilla_blu_150.gif);background-repeat:no-repeat;">'
                         + '<div style="width:150px;height:150px;"><img id="pop_star_pic" src="/pornstars/images/star_default.jpg" width="150" height="150" alt="" /></div></div>';
  pop_star.setContentPadding(0,0,0,0);
  pop_star.setContentSize(152, 152);
  pop_star.create();

  var popStarTimerId     = 0;
  var popStarTimerStanby = 300;

  popStarPicDefault = function(){
    setOpacity("#pop_star_div", 0.7);
    $("#pop_star_pic").hide();
    $("#pop_star_div").css('border', 'solid #888888 1px');
  }
  $("#pop_star_pic").load(function(){
    setOpacity("#pop_star_div", 1.0);
    $("#pop_star_pic").fadeIn(100);
    $("#pop_star_div").css('border', 'solid #666666 1px');
  });
  var setOpacity = function(obj, opc)
  { $(obj).css({'filter':'alpha(opacity='+opc*100+')','-moz-opacity':opc,'opacity':opc});
  }

  popStarShow = function(id, posX, posY){
    popStarPicDefault();
    var attr = id.split('::');
    pop_star.fadeIn('fast', posX, posY);
    $("#pop_star_pic").attr('src', '/pornstars/images/'+attr[1].replace(/:/g, "'")+'.jpg');
  }
  var popStarHide = function(){
    clearTimeout(popStarTimerId);
  	pop_star.fadeOut('fast');
  }

  $(".starlink, .starlink_on, .preview_slink").mouseover(function(e){
    var linkW   = $(this).width();
    var linkPos = $(this).position();
    var scrY    = $(window).scrollTop();
    var popY    = linkPos.top-pop_star.height+3 > scrY ? linkPos.top-pop_star.height+3 : linkPos.top+8;

    popStarTimerId = setTimeout("popStarShow('"+$(this).attr('id')+"', "+(linkW+linkPos.left-3)+", "+popY+")", popStarTimerStanby);
  }).mouseout(function(e){
    popStarHide();
  });

  $(".starmenu, .starmenu_on").mouseover(function(e){
    var linkPos = $(this).position();
    var scrY    = $(window).scrollTop();
    var popY    = linkPos.top-pop_star.height+8 > scrY ? linkPos.top-pop_star.height+8 : linkPos.top+8;

    popStarTimerId = setTimeout("popStarShow('"+$(this).attr('id')+"', "+(linkPos.left-pop_star.width-3)+", "+popY+")", popStarTimerStanby);
  }).mouseout(function(e){
    popStarHide();
  });

});

/*************************************/
//        popMoreContent
/*************************************/
popMoreContent =
 '<div style="font-family:Trebuchet MS;font-size:12px;background-color:#FFFFCC;">'
+'<div class="cont_title">Use our Specials and get FREE movies!</div>'
+'<table width="100%" cellpadding="0" cellspacing="0" border="0">'
+'<tr><td valign="top" class="cont_ico_td">'
+'        <img src="/images/icons/ico_save_one_75x75_FFFFCC.gif" width="75" height="75"></td>'
+'    <td valign="top" class="cont_desc_td">'
+'        <div class="cont_title_sub">Buy <span class="cont_title_specials_buy">3</span> &nbsp;Get <span class="cont_title_specials_get">3</span> FREE <span class="cont_title_specials_per">($1.00 per movie)</span></div>'
+'Add 6 movies in your cart.<br>You will only be charged for 3 movies.<br>'
+'    </td>'
+'</tr>'
+'<tr><td valign="top" class="cont_ico_td">'
+'        <img src="/images/icons/ico_save_two_75x75_FFFFCC.gif" width="75" height="75"></td>'
+'    <td valign="top" class="cont_desc_td">'
+'        <div class="cont_title_sub">Buy <span class="cont_title_specials_buy">6</span> &nbsp;Get<span class="cont_title_specials_get">10</span> FREE <span class="cont_title_specials_per">($0.75 per movie)</span></div>'
+'Add 16 movies in your cart.<br>You will only be charged for 6 movies.<br>'
+'    </td>'
+'</tr>'
+'<tr><td valign="top" class="cont_ico_td">'
+'        <img src="/images/icons/ico_save_three_75x75_FFFFCC.gif" width="75" height="75"></td>'
+'    <td valign="top" class="cont_desc_td">'
+'        <div class="cont_title_sub">Buy<span class="cont_title_specials_buy">10</span> &nbsp;Get <span class="cont_title_specials_get">20</span> FREE <span class="cont_title_specials_per">(<span style="color:#FF0000;">$0.67</span> per movie)</span></div>'
+'Add 30 movies in your cart.<br>You will only be charged for 10 movies.<br>'
+'    </td>'
+'</tr>'
+'</table>'
+'</div>';


