﻿// JScript File
function ReturnConfirm(msg)
{
    var response=confirm(msg +"\n(OK = YES   Cancel = NO)");  
    document.forms.aspnetForm.ctl00$hdnResponse.value=response;  
    //document.forms.aspnetForm("ctl00$PageContent$hdnResponse").value= response; 
}
function openPopup()
{ 
    var oPopup = window.createPopup();
    var oPopBody = oPopup.document.body;
    
    oPopBody.style.color = "#ffffff";//"#483D8B";
    oPopBody.style.fontFamily = "verdana,helvetica,arial";
    oPopBody.style.fontSize = "17px";
    oPopBody.style.backgroundColor = "#658b32";//"lightyellow";
    oPopBody.style.border = "solid black 1px";
    oPopBody.innerHTML = "Loading, please wait...";//<img src='../Image/4_rhombuses.gif'></img>";
    //oPopBody.style.verticalAlign = "middle";
    //oPopBody.HorizontalAlign = "center";
    oPopup.show(0, -10, 200, 28, document.body);
}
function showHelp(myPopup,menuID,text,width,height) {
  //var myPopup = window.createPopup();
  var popupBodyObj = myPopup.document.body;
  var objID = menuID.id;  
  //popupBodyObj.className = "popup";
  popupBodyObj.style.color =  "#000000"; //blue
  popupBodyObj.style.border =  "1px"; //black
  popupBodyObj.style.borderColor=  "#000000"; //black
  popupBodyObj.style.borderStyle="solid";
  popupBodyObj.style.padding = "3px";
  popupBodyObj.style.fontSize = "11px";
  popupBodyObj.style.fontFamily = "verdana,helvetica,arial";  
  popupBodyObj.style.backgroundColor ="#eee8cd";// "#ccccff";
  popupBodyObj.innerHTML =text;
  myPopup.document.documentElement.id = "popup_obj"
  myPopup.show(0, menuID.offsetHeight+5, width, height, menuID); 
}
function hideHelp(myPopup) {
        //currently this function is not called,
        myPopup.hide;
        myPopup.document.body.style.display = "none";
        myPopup.document.body.style.visibility="hidden";
}
function setFocus(){
    var oElement=document.all;
    if (oElement.length>0) {
        for (var i = 0; i < oElement.length; i++) {    
        if (oElement(i).tagName=="INPUT") {                   
            if (oElement(i).id.substring(0,2)!="__"){
            if (oElement(i).type!="hidden") {
            oElement(i).focus();
            return;
            }
            }
           }           
        else if (oElement(i).tagName=="SELECT"){                   
            if (oElement(i).id.substring(0,2)!="__"){
            oElement(i).focus();
            return;
            }
           }        
        }
     }
}

function GetOpener(opener)
{   
    document.forms.aspnetForm.ctl00$PageContent$hdnOpener.value=opener;
    //document.forms.aspnetForm.hdnOpener.value=opener;                        
}
function hideElement(e_id)
{
document.all[e_id].style.display = 'none';
}

function showElement(e_id)
{
document.all[e_id].style.display = '';
}
function mod(divisee,base) {
return Math.round(divisee-(Math.floor(divisee/base)*base));
}

var image_index=0; 
var imglink_index = 0;
var hyperlink_index=0;
var title_index=0;
var updateat_index=0;
var views_index=0;
var loop=0;
var place_loop=0;
var interval=1800;
var timeout_id;
images=new Array();
imglink=new Array();
hyperlink=new Array(); 
title=new Array();
updateat=new Array();
views=new Array();


function imageItem(image_location) {
this.image_item = new Image();
this.src = image_location;
}

function linkItem(link_location) {
this.link_item=new String();
this.value = link_location;
}


function createImage(image_url){
images[image_index++] = new imageItem(image_url);
}

function createimglink(url){
imglink[imglink_index++]=new linkItem(url);
}
function createhyperlink(url){
hyperlink[hyperlink_index++]=new linkItem(url);
}

function createtitle(text){
title[title_index++]=new linkItem(text);
}

function createupdateat(text){
updateat[updateat_index++]=new linkItem(text);
}

function createviews(text){
views[views_index++]=new linkItem(text);
}


function animateImages() { 
var place0 = "ctl00_PageContent_image_placeholder0";
var place1 = "ctl00_PageContent_image_placeholder1";
var place2 = "ctl00_PageContent_image_placeholder2";
var place3 = "ctl00_PageContent_image_placeholder3";
 if (images.length==0) 
   {
   get_rotate_content(); 
   }  
  if (loop>=images.length) loop = 0;
  if (place_loop>=4)place_loop=0;
  if (place_loop==0) {
    if(document[place0]) {    
     if (typeof document[place0].filters != "undefined" ) {
   	    document[place0].style.filter = 'blendTrans(duration=1)';
        if (document[place0].filters.blendTrans) {
        document[place0].filters.blendTrans.Apply();
        
       }
     }
       document[place0].src=images[loop].src; 
       imglink_placeholder0.href=imglink[loop].value; 
       hyperlink_placeholder0.href=hyperlink[loop].value; 
       document.all["titles0"].value=title[loop].value; 
       document.all["updatedats0"].value=updateat[loop].value;
       document.all["views0"].value=views[loop].value;
       document[place0].filters.blendTrans.Play();
        }
     }
   else if (place_loop == 1 ){
   if(document[place1]) {
    if (typeof document[place1].filters != "undefined" ) {
   	    document[place1].style.filter = 'blendTrans(duration=1)';
        if (document[place1].filters.blendTrans) {
        document[place1].filters.blendTrans.Apply(); 
       }
     }
   document[place1].src=images[loop].src; 
   imglink_placeholder1.href=imglink[loop].value; 
   hyperlink_placeholder1.href=hyperlink[loop].value; 
   document.all["titles1"].value=title[loop].value; 
   document.all["updatedats1"].value=updateat[loop].value;
   document.all["views1"].value=views[loop].value;
   document[place1].filters.blendTrans.Play();
    }
    }
   else if (place_loop ==2){
   if(document[place2]) {
    if (typeof document[place2].filters != "undefined" ) {
   	    document[place2].style.filter = 'blendTrans(duration=1)';
        if (document[place2].filters.blendTrans) {
        document[place2].filters.blendTrans.Apply();
       }
     }
   document[place2].src=images[loop].src; 
   imglink_placeholder2.href=imglink[loop].value; 
   hyperlink_placeholder2.href=hyperlink[loop].value; 
   document.all["titles2"].value=title[loop].value; 
   document.all["updatedats2"].value=updateat[loop].value;
   document.all["views2"].value=views[loop].value;
   document[place2].filters.blendTrans.Play();
    }
    }
   else if (place_loop == 3) {
   if(document[place3]) {
    if (typeof document[place3].filters != "undefined" ) {
   	    document[place3].style.filter = 'blendTrans(duration=1)';
        if (document[place3].filters.blendTrans) {
        document[place3].filters.blendTrans.Apply();         
       }
     }
   document[place3].src=images[loop].src;
   imglink_placeholder3.href=imglink[loop].value; 
   hyperlink_placeholder3href=hyperlink[loop].value; 
   document.all["titles3"].value=title[loop].value; 
   document.all["updatedats3"].value=updateat[loop].value;
   document.all["views3"].value=views[loop].value;
   document[place3].filters.blendTrans.Play();
    } 
    }    
   timeout_id=setTimeout("animateImages('"+place0+"','"+place1+"','"+place2+"','"+place3+"')",interval);         
   loop++;
   place_loop++;    
}
function cleartimes(){
clearTimeout(timeout_id); 
timeout_id=null;
}
function resumetimes(){
var place0 = "ctl00_PageContent_image_placeholder0";
var place1 = "ctl00_PageContent_image_placeholder1";
var place2 = "ctl00_PageContent_image_placeholder2";
var place3 = "ctl00_PageContent_image_placeholder3";
timeout_id=setTimeout("animateImages('"+place0+"','"+place1+"','"+place2+"','"+place3+"')",interval);         
}

var ScreenLine = new Array();

var msgNum = 1;          // set to first message to display
var msgCnt = 1;         // set to number of last ScreenLine to display.
var typeSpeed = 2200;      // the rate in milliseconds to scroll to top (higher number is slower)
var lineDelay = 2200;     // the delay time at end of line. (unless the line is a single space)
var pagLen = 6;          // number of lines per page (usually the number of rows in the TEXTAREA)  
var writeCnt = 0;
var delay = typeSpeed;     
var timerPS = null;
var outMsg = "";
var passed = 0;

function pass_verses(index,text){
    ScreenLine[index]=text;
    msgCnt =index; 
    passed=1;
}

function DisplayScroll() {
    if (passed == 0) {get_verses();}
    if (msgNum < pagLen) 
        {delay = typeSpeed;}
    else {delay = lineDelay;} 
    ChangeMsg(); 
}


function ChangeMsg() { 
 
 if (msgNum > msgCnt){//if msgCnt< pagLen or write to the end, reset outMsg and msgCnt
     outMsg = "";
     msgNum = 1;
     writeCnt = 0;
 }
 if (writeCnt==pagLen) //if page is full, reset outMsg and writeCnt
 {
 outMsg = "";
 writeCnt = 0;
 }
 outMsg +=  ScreenLine[msgNum]+"\n";
 document.all['ctl00$PageContent$verses'].value=outMsg;
 timerPS = setTimeout("DisplayScroll()",delay);
 msgNum++;
 writeCnt++; //count from 1
}

var l1;// =parseInt(document.all['ctl00_imgCompanyLogo'].offsetLeft);//230; // left of ticker in pixel, or 0 to position relative
var t1 =   -1; // top of ticker in pixel, or 0 to position relative
var w1;// =parseInt(document.all['ctl00_imgCompanyLogo'].offsetWidth); //790 width of ticker in pixel
var ie = document.all ? true : false;
var first = true;
var l2 = l1 + w1;
var l3 = l1 - l2;
var l = l2;
function tickinit(obj) {
l1 = parseInt(document.all[obj].offsetLeft);
w1 = parseInt(document.all[obj].offsetWidth);
if (ie) {
if (l1 == 0 && t1 == 0) {
pos = document.all['tickpos'];
l1 = getLeft(pos);
t1 = getTop(pos);
}
ticktext.style.posTop = t1;
}
else {
if (l1 == 0 && t1 == 0) {
pos = document.anchors['tickpos'];
l1 = pos.x;
t1 = pos.y;
}
document.ticktext.pageY = t1;
}

l2 = l1 + w1;
l3 = l1 - l2;
l = l2;
setInterval('tick()', 10);
}
function getLeft(ll) {
if (ll.offsetParent)
return (ll.offsetLeft + getLeft(ll.offsetParent));
else 
return (ll.offsetLeft);
}
function getTop(ll) {
if (ll.offsetParent)
return (ll.offsetTop + getTop(ll.offsetParent));
else
return (ll.offsetTop);
}
function tick() {
l = l - 0.5;
if (l < l3) l = l2;
cl = l1 - l;
cr = l2 - l;
if (ie) {
ticktext.style.posLeft = l;
ticktext.style.posTop = t1;
ticktext.style.clip = "rect(auto "+cr+"px auto "+cl+"px)";
if (first) ticktext.style.visibility = "visible";
}
else {
document.ticktext.pageX = l;
document.ticktext.clip.left = cl;
document.ticktext.clip.right = cr;
if (first) document.ticktext.visibility = "show";
}
first = false;
}
function scrollIt(obj) {  
if (document.all[obj]) {
var x = parseInt(document.all[obj].offsetLeft);   
var y = parseInt(document.all[obj].offsetTop);   
window.scrollTo(x, y-25);
}
}