//Always-on-top message Script- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, and Terms Of use, visit dynamicdrive.com
//This credit MUST stay intact for use


//enter the message you wish to be shown, including html tags

var message='<table><tr><td><img src="afra_icon2.gif"></td>  <td><b><center><font color="white" size=3><a href="book_outline.html#content">Table of Content</a><br><a href="eman2.html">Home Page    </a></font></b><center></td></tr></table>'

//enter a color name or hex to be used as the background color of the message
var backgroundcolor="336600"

//enter 1 for always display, 2 for ONCE per browser session
var displaymode=1

//Set duration message should appear on screen, in seconds (10000=10 sec,0=perpetual)
var displayduration=0

//enter 0 for non-flashing message, 1 for flashing
var flashmode=0
//if above is set to flashing, enter the flash-to color below
var flashtocolor="red"

// substitute 116 and 42 with the width and height of your logo image, respectively
var logowidth=240
var logoheight=25


// Optional parameters
var Hoffset=30//Enter logo's offset from right edge of window (edit only if you don't like the default offset)
var Voffset=30//Enter logo's offset from bottom edge of window (edit only if you don't like the default offset)


///////////////do not edit below this line////////////////////////////////////////
var ie=document.all
var ieNOTopera=document.all&&navigator.userAgent.indexOf("Opera")==-1

function regenerate(){
window.location.reload()
}

function regenerate2(){
if (document.layers)
setTimeout("window.onresize=regenerate",400)
}

var which=0

function flash(){
if (which==0){
if (document.layers)
topmsg2_obj.bgColor=flashtocolor
else
topmsg2_obj.style.backgroundColor=flashtocolor
which=1
}
else{
if (document.layers)
topmsg2_obj.bgColor=backgroundcolor
else
topmsg2_obj.style.backgroundColor=backgroundcolor
which=0
}
}

if (ie||document.getElementById)
document.write('<div id="topmsg2" style="position:absolute;visibility:hidden">'+message+'</div>')

var topmsg2_obj=ie? document.all.topmsg2 : document.getElementById? document.getElementById("topmsg") : document.topmsg2

function positionit(){
var dsocleft=ie? document.body.scrollLeft : pageXOffset
var dsoctop=ie? document.body.scrollTop : pageYOffset
var window_width=ieNOTopera? document.body.clientWidth : window.innerWidth-20
var window_height=ieNOTopera? document.body.clientHeight : window.innerHeight

if (ie||document.getElementById){
topmsg2_obj.style.left=parseInt(dsocleft)+parseInt(window_width)-logowidth-Hoffset
topmsg2_obj.style.top=parseInt(dsoctop)+parseInt(window_height)-logoheight-Voffset
}
else if (document.layers){
topmsg2_obj.left=dsocleft+window_width/2-topmsg2_obj.document.width/2
topmsg2_obj.top=dsoctop+window_height-topmsg2_obj.document.height-5
}
}

function setmessage(){
if (displaymode==2&&(!display_msg_or_not()))
return
if (document.layers){
topmsg2_obj=new Layer(window.innerWidth)
topmsg2_obj.bgColor=backgroundcolor
regenerate2()
topmsg2_obj.document.write(message)
topmsg2_obj.document.close()
positionit()
topmsg2_obj.visibility="show"
if (displayduration!=0)
setTimeout("topmsg2_obj.visibility='hide'",displayduration)
}
else{
positionit()
topmsg2_obj.style.backgroundColor=backgroundcolor
topmsg2_obj.style.visibility="visible"
if (displayduration!=0)
setTimeout("topmsg2_obj.style.visibility='hidden'",displayduration)
}
setInterval("positionit()",100)
if (flashmode==1)
setInterval("flash()",1000)
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function display_msg_or_not(){
if (get_cookie("displaymsg")==""){
document.cookie="displaymsg=yes"
return true
}
else
return false
}

if (document.layers||ie||document.getElementById)
window.onload=setmessage
