var isModerator = false;
var isSenior = true;
var moderator_logins=new Array("MrBrown","MrBrown");

var message='\n The Graphics on this page are copyrighted and not available for download or use.\n'; 
function click(e) {if (document.all) {if (event.button == 2) {alert(message);return false;}}if (document.layers) {if (e.which == 3) {alert(message);return false;}}}if (document.layers) {document.captureEvents(Event.mousedown);}document.onmousedown=click;
var bV=parseInt(navigator.appVersion);NS4=(document.layers) ? true : false;IE4=((document.all)&&(bV>=4))?true:false;ver4 = (NS4 || IE4) ? true : false;isExpanded = false;
with ( document )
{write("<STYLE TYPE='text/css'>");write(".item {color: #EFEFEF; text-decoration:none; cursor: hand; line-height:16px; border-bottom:1px solid #E5E5E5}");write(".highlight {color: black; background-color:#FFFF80; text-decoration:none; line-height:16px;}");write("</STYLE>");}

function w(s)
{
document.write(s);
}

function checkForSL()
{
if (geoip_country_name() == 'Test Sri Lanka') location.replace("http://www.lankanewspapers.com/notavailable.html");
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

var login = getCookie("loginID");
var rank = getCookie("rank");

if ((rank!=null) && (rank.indexOf("senior")!=-1)) isSenior = true;

for (i=0; i<moderator_logins.length; ++i) 
{
   if (moderator_logins[i]==login) isModerator=true; 
}

function editPath(path)
{
 if (isModerator)
 {
     document.write("<br><a href='"+path+"' class=ex>Edit</a>");
 }
}

function userEdit(path,user)
{ 
 if ( (login!=null) && (login.toUpperCase()==user.toUpperCase()) )
 {
     document.write("<br><a href='"+path+"' class=ex>Edit this post</a>");
 }
}

function toFavorites(postID,user)
{ 
 if ( (login!=null) && (login.toUpperCase()==user.toUpperCase()) )
 {
     document.write("<a href='http://www.lankanewspapers.com/news/members/addToProfile.jsp?id="+postID+"' class='newsPostButton2'>Add to My Profile</a>");
 }
 else
 {
     document.write("<a href='http://www.lankanewspapers.com/news/members/addToFavorites.jsp?id="+postID+"' class='newsPostButton'>Add to Favorites</a>");
 }
}


function memberSnd(path)
{
 if (isModerator)
 {
     document.write("<br><a href='"+path+"' class=ex>Snd</a>");
 }
}

function memberMsg(path)
{
 if (isModerator)
 {
     document.write("<br><a href='"+path+"' class=ex>Msg</a>");
 }
}

function report(path)
{
 if (isSenior)
 {
     document.write("<br><a href='"+path+"' class=black>Report for abuse</a>");
 }
}


function showLNPCreationImage(articleId,member,postid)
{
var post_div = document.getElementById(postid);
var creationCredit = "News Creation at Lankanewspapers by " + member;
var imagePath = "http://www.lankanewspapers.com/news/members/creations/" + member + "_" + articleId + ".jpg";
var div_html  = "<div style='margin:10px;'><img style='border-color:#eeeeee' src='"+imagePath+"' border='1' alt='"+creationCredit+"'></div>";
    //div_html += "<div style='margin-left:10px;margin-bottom:5px;' class=tiny><a href=\"javascript:download_lnp_image('"+imagePath+"')\" class=gray>Download This</a></div>";
post_div.innerHTML = div_html;
}


function download_lnp_image(path) 
{
var newwindow;
obj = path
newWindow = window.open( obj, "SaveImage","directories=no,status=no,menubar=no,toolbar=no,resizable=no,top=100000,left=100000,width=0,height=0");
newWindow.document.execCommand('SaveAs', true);
newWindow.close();
return false;
}



