﻿// JScript File

//// JScript File



////configure tickercontents[] to set the messges you wish be displayed (HTML codes accepted)
////Backslash any apostrophes within your text (ie: I\'m the king of the world!)


//var persistlastviewedmsg=1 //should messages' order persist after users navigate away (1=yes, 0=no)?
//var persistmsgbehavior="onload" //set to "onload" or "onclick".

////configure the below variable to determine the delay between ticking of messages (in miliseconds):
//var tickdelay=5000

//////Do not edit pass this line////////////////

//var divonclick=(persistlastviewedmsg && persistmsgbehavior=="onclick")? 'onClick="savelastmsg()" ' : ''
//var currentmessage=0

//function changetickercontent(){
//if (crosstick.filters && crosstick.filters.length>0)
//crosstick.filters[0].Apply()
////alert(currentmessage);
//crosstick.innerHTML=tickercontents[currentmessage]
//if (crosstick.filters && crosstick.filters.length>0)
//crosstick.filters[0].Play()
//currentmessage=(currentmessage==tickercontents.length-1)? currentmessage=0 : currentmessage+1
//var filterduration=(crosstick.filters&&crosstick.filters.length>0)? crosstick.filters[0].duration*1000 : 0
//setTimeout("changetickercontent()",tickdelay+filterduration)
//}

//function beginticker(){

//if (persistlastviewedmsg && get_cookie("lastmsgnum")!="")
//revivelastmsg()
//crosstick=document.getElementById? document.getElementById("memoryticker") : document.all.memoryticker
//changetickercontent()
////document.cookie="lastmsgnum="+""
//}

//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 savelastmsg(){
////debugger;
//document.cookie="lastmsgnum="+currentmessage
//}

//function revivelastmsg(){
//currentmessage=parseInt(get_cookie("lastmsgnum"))
//currentmessage=(currentmessage==0)? tickercontents.length-1 : currentmessage-1
//}

//if (persistlastviewedmsg && persistmsgbehavior=="onload")
//window.onunload=savelastmsg

//if (document.all||document.getElementById)
//document.write('<div class="flashni">')
//document.write('<div class="flash-txt">  News Flash </div>')
//document.write('<div id="memoryticker" class="flash-link" '+divonclick+'></div>')
//document.write('</div>')
//if (window.addEventListener)
//window.addEventListener("load", beginticker, false)
//else if (window.attachEvent)
//window.attachEvent("onload", beginticker)
//else if (document.all || document.getElementById)
//window.onload=beginticker


function domticker(content, divId, divClass, delay, fadeornot){

this.content=content
this.tickerid=divId //ID of master ticker div. Message is contained inside first child of ticker div
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
this.pointer=1
this.opacitystring=(typeof fadeornot!="undefined")? "width: 100%; filter:progid:DXImageTransform.Microsoft.alpha(opacity=100); -moz-opacity: 1" : ""
if (this.opacitystring!="") this.delay+=500 //add 1/2 sec to account for fade effect, if enabled
this.opacitysetting=0.2 //Opacity value when reset. Internal use.
document.write('<div class="flash1 clearfix">')
document.write('<div class="flash-txt"> <span> ब्रेकिंग न्यूज</span></div>')
document.write('<div id="'+divId+'" class="'+divClass+'"><div style="'+this.opacitystring+'">'+content[0]+'</div></div>')
document.write('</div>')
var instanceOfTicker=this
setTimeout(function(){instanceOfTicker.initialize()}, delay)
}

domticker.prototype.initialize=function(){
var instanceOfTicker=this
this.contentdiv=document.getElementById(this.tickerid).firstChild //div of inner content that holds the messages
document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
this.rotatemsg()
}

domticker.prototype.rotatemsg=function(){
var instanceOfTicker=this
if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
else{
this.fadetransition("reset") //FADE EFFECT- RESET OPACITY
this.contentdiv.innerHTML=this.content[this.pointer]
this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100) //FADE EFFECT- PLAY IT
this.pointer=(this.pointer<this.content.length-1)? this.pointer+1 : 0
setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container
}
}

// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------

domticker.prototype.fadetransition=function(fadetype, timerid){
var contentdiv=this.contentdiv
if (fadetype=="reset")
this.opacitysetting=0.2
if (contentdiv.filters && contentdiv.filters[0]){
if (typeof contentdiv.filters[0].opacity=="number") //IE6+
contentdiv.filters[0].opacity=this.opacitysetting*100
else //IE 5.5
contentdiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
}
else if (typeof contentdiv.style.MozOpacity!="undefined" && this.opacitystring!=""){
contentdiv.style.MozOpacity=this.opacitysetting
}
else
this.opacitysetting=1
if (fadetype=="up")
this.opacitysetting+=0.2
if (fadetype=="up" && this.opacitysetting>=1)
clearInterval(this[timerid])
}
