﻿// JScript File

function reportDead(q, elm)
{
    elm.innerHTML = "<table><tr><td><img src='"+host+"images/loading.gif' style='width: 18px;' /></td><td>Loading...</td></tr></table>";
    $.ajax({
       type: "GET",
       cache: false,
       url: host + "AJ/process.aspx?a=reportdead&q=" + q,
       success: function(msg){
         $(elm).css("padding: 3px;");
         elm.innerHTML = msg + ", thank you!!";
       }
     });
}
var msgRet = "";
function runthis(q)
{
    window.scroll(0,500);
    document.getElementById('divPlayer').innerHTML = '<div style="margin-top: 70px; margin-left: 150px;"><iframe src="http://ads.ireel.com/banner/display?id=62&ref=8837" width="300" height="250" frameborder="0" scrolling="no" allowtransparency="true"  marginheight="0" marginwidth="0" ></iframe><table><tr><td><img src="'+host+'images/loading.gif" /></td><td style="font-size: 15px;"><b>Video Loading...</b></td></tr></table></div>';
    
    //<a target="_blank" href="http://stream-onlinemovies.com/?hop=heepo"><IMG border="0" style="width: 600px; height: 370px;" src="http://www.heepo.com/monetizers/moviead3.jpg"></a><br><table><tr><td><img src="'+host+'images/loading.gif" /></td><td style="font-size: 15px;"><b>Video Loading...</b></td></tr></table>';
    //document.getElementById('divPlayer').innerHTML = "<img src='"+host+"images/loading.gif' /> Loading...";
    $.ajax({
       type: "GET",
       cache: false,
       url: host + "AJ/Getit.aspx?q=" + q,
       success: function(msg){
         msgRet = msg;
         setTimeout("setHtml();", 6000);
       }
     });
}
function setHtml()
{
    $('#divPlayer').html(msgRet);
}
function openMovie(q,id)
{
    openDialog(id);
    document.getElementById("txtCurAction").value = "openMovie('" + q + "', " + id +")";
    $('#accordion').html("<img src='"+host+"images/loading.gif' />");
    $.ajax({
       type: "GET",
       cache: false,
       url: host + "AJ/Getit.aspx?q=" + q,
       success: function(msg){
         document.getElementById('accordion').innerHTML = msg.split('|')[0];
         $("#accordion").accordion("destroy");
        $("#accordion").accordion({ 
            header: "h3", 
            animated: "bounceslide",
            autoHeight: true,
            icons: {
                 header: "ui-icon-arrow-1-e",
                 headerSelected: "ui-icon-arrow-1-s"
               }
            });
            if(msg.split('|').length > 1)
                setTimeout(msg.split('|')[1], 1000);
       }
     });
}
function openDialog(id)
{
    $('#dialog').dialog("destroy");
    //$("#divPlayer").html("<div style='font-size: 19px; text-align: center; padding-top: 160px;'><b>.. Click links on the right to play ..<b></div>");
    //$("#divPlayer").html('<a target="_blank" href="http://stream-onlinemovies.com/?hop=heepo"><IMG border="0" style="width: 600px; height: 370px;" src="http://www.heepo.com/monetizers/moviead3.jpg"></a>');
    $("#divPlayer").html('<div style="margin-top: 70px; margin-left: 150px;"><iframe src="http://ads.ireel.com/banner/display?id=62&ref=8837" width="300" height="250" frameborder="0" scrolling="no" allowtransparency="true"  marginheight="0" marginwidth="0" ></iframe><table><tr><td><img src="'+host+'images/loading.gif" /></td><td style="font-size: 15px;"><b>Video Loading...</b></td></tr></table></div>');
    $('#dialog').dialog({
        autoOpen: false,
        width: 830,
        height: 630,
        modal: false,
        title: $('#div' + id).attr("title"),
        buttons: {
            "Close": function() { 
                $(this).dialog("destroy");
                $("#divPlayer").html(".. Please select a movie link on the right to play here ..");
            } 
        }
    });
    $('#dialog').dialog('open');
}
$(function() {
    //hover states on the static widgets
    $('#dialog_link, ul#icons li, div.dial').hover(
        function() { $(this).addClass('ui-state-hover'); }, 
        function() { $(this).removeClass('ui-state-hover'); }
    );
});

var pageSize=20;
var curGenre;
function kickGetGenre(p)
{
    $("#divContentHead").html("<h2>"+curGenre+"</h2><img src='"+host+"images/loading.gif'/>");
    makeCall(host + "aj/GetData.aspx?a=movies&q=genre&s=" + curGenre + "&p="+ p + "&ps=" + pageSize, "$('#divContentHead').html('<h2>'+curGenre+'</h2>');");
}
function getGenre(id, p, elm)
{
    clearMovie();
    $(".dial").toggleClass("ui-state-active", false);
    $("#divContentHead").html("<h2>"+id+"</h2>");
    $("#selectable").html("<img src='"+host+"images/loading.gif'/>");
    curGenre = id;
    makeCall(host + "aj/GetData.aspx?a=movies&q=genre&s=" + id + "&p="+ p + "&ps=" + pageSize, finishList(id));
    //ui-selected
    $("#ulAllCat li").toggleClass("ui-selected", false);
    $(elm).toggleClass("ui-selected", true);
}

function getList(id)
{
    clearMovie();
    $("#ulAllCat li").toggleClass("ui-selected", false);
    $(".dial").toggleClass("ui-state-active", false);
    $("#divList" + id).toggleClass("ui-state-active", true);
    $("#selectable").html("<img src='"+host+"images/loading.gif'/>");
    if(id==1)
    {
    $("#divContentHead").html("<h2>Featured movies</h2>");
    makeCall(host + "aj/GetData.aspx?a=movies&q=featured", finishList(id));
    }
    if(id==2)
    {
    $("#divContentHead").html("<h2>New Releases</h2>");
    makeCall(host + "aj/GetData.aspx?a=movies&q=newreleases", finishList(id));
    }
    if(id==3)
    {
    $("#divContentHead").html("<h2>New links</h2>");
    makeCall(host + "aj/GetData.aspx?a=movies&q=newlinks", finishList(id));
    }
    if(id==4)
    {
    $("#divContentHead").html("<h2>2009 Movies</h2>");
    searchYear("2009");
    }
    if(id==5)
    {
    $("#divContentHead").html("<h2>2008 Movies</h2>");
    searchYear("2008");
    }
    if(id==6)
    {
    $("#divContentHead").html("<h2>2007 Movies</h2>");
    searchYear("2007");
    }
}
function finishList(id)
{
    if(id==1)
    $("#divContentHead").html("<h2>Featured movies</h2>");
    if(id==2)
    $("#divContentHead").html("<h2>New Releases</h2>");
    if(id==3)
    $("#divContentHead").html("<h2>New links</h2>");
    if(id==4)
    $("#divContentHead").html("<h2>2009 Movies</h2>");
    if(id==5)
    $("#divContentHead").html("<h2>2008 Movies</h2>");
    if(id==6)
    $("#divContentHead").html("<h2>2007 Movies</h2>");
}

function makeCall(url, callBack)
{
    $.ajax({
       type: "GET",
       cache: false,
       url: url,
       success: function(msg){
        $("#selectable").html(msg);
        eval(callBack);
       }
     });
}

function searchYear(y)
{  
    clearMovie();
    document.getElementById("txtSearch").value = y;
    $("#divContentHead").html("<h2>Search result</h2><img src='"+host+"images/loading.gif'/>");
    $("#ulAllCat li").toggleClass("ui-selected", false);
    $(".dial").toggleClass("ui-state-active", false);
    makeCall(host + "aj/GetData.aspx?a=movies&q=search&s=" + y+ "&ps=" + pageSize + "&p=1", "$('#divContentHead').html('<h2>Search result</h2>');");
}

function kickSearch(p)
{
    if(p==null)
        p=1;
    if(document.getElementById("txtSearch").value.length > 2)
    {
    $("#divContentHead").html("<h2>Search result</h2><img src='"+host+"images/loading.gif'/>");
    $("#ulAllCat li").toggleClass("ui-selected", false);
    $(".dial").toggleClass("ui-state-active", false);
    makeCall(host + "aj/GetData.aspx?a=movies&q=search&s=" + document.getElementById("txtSearch").value.replace("&", "*amp")+ "&ps=" + pageSize + "&p=" + p, "$('#divContentHead').html('<h2>Search result</h2>');");
    }
}

function searchMovie(elm, e, p)
{
    clearMovie();
    if(p==null)
        p=1;
    if(elm.value.length > 2 && ((e.keyCode > 64 && e.keyCode < 91) || (e.keyCode > 96 && e.keyCode < 123) || (e.keyCode > 47 && e.keyCode < 58) || e.keyCode == 8))
    {
    $("#divContentHead").html("<h2>Search result</h2><img src='"+host+"images/loading.gif'/>");
    $("#ulAllCat li").toggleClass("ui-selected", false);
    $(".dial").toggleClass("ui-state-active", false);
    makeCall(host + "aj/GetData.aspx?a=movies&q=search&s=" + elm.value.replace("&", "*amp")+ "&ps=" + pageSize + "&p=" + p, "$('#divContentHead').html('<h2>Search result</h2>');");
    }
}

$(document).ready(function() {

var html ='<table cellpadding="1" cellspacing="0" style="width: 100%;">';
    html +='<tr>';
        html +='<td style="vertical-align: top; width: 410px;">';
            html +='<div id="divPlayer" style="width: 600px; height: 400px; border: 1px solid #CCCCCC;">';
                html +='<div style="display: none;">.. Please select a movie link on the right to play here ..';
                html +='<div style="font-size: 11px; color: #555555;">The "Other" links will open in a seperate window and you will be redirected to the source of the content. We really appreciate your patientce and Thank you for using our service as your entertainment service.</div></div>';
            html +='</div>';
            html += '<a target="_blank" href="http://click.linksynergy.com/fs-bin/click?id=n2i*4bsVRW4&offerid=173504.10000401&type=4&subid=0"><IMG alt="Netflix, Inc." border="0" src="http://cdn.netflix.com/us/affiliates/banners/0804/468060B_599.gif"></a><IMG border="0" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=n2i*4bsVRW4&bids=173504.10000401&type=4&subid=0">';
        html +='</td>';
        html +='<td style="vertical-align: top;">';
            html +='<div id="accordion" style="width: 100%"></div>';
            html +='<div style="padding-top: 10px; width: 100%; text-align: center;"><iframe src="http://ads.ireel.com/banner/display?id=68&ref=8837" width="181" height="44" frameborder="0" scrolling="no" allowtransparency="true"  marginheight="0" marginwidth="0" ></iframe></div>';
        html +='</td>';
    html +='</tr>';
    html +='<tr>';
        html +='<td colspan="2" style="font-size: 9px; width: 600px;">';
            html +='Disclaimer: heepo.com is completely legal and we DO NOT host or upload any movie, film or media files of any kind.';
            html +='We are simply a directory of links uploaded by users and fans. If you have any legal issues or complaints of any kind please contact the appropriate media file owners / hosters.';
            html +='heepo.com is not responsible for the accuracy, compliance, copyright, legality, decency, or any other aspect of the content of other linked sites.';
            html +='<br /><br />Dead Link: Movie links have a very short lifetime so please help us by reporting dead links and we will do our best';
            html +='to take them down in a timely manner, sorry for any inconveniences !';
        html +='</td>';
    html +='</tr>';
html +='</table>';
$("#dialog").html(html);
});

//setTimeout("setDialog();", 1500);
