﻿// JScript File
 var timeclicker;
function TimeClick () {
     timeclicker = setInterval("ClickIt();",1500);
}

function ClickIt() {
    //alert('check1');
    clearInterval(timeclicker);
    if (document.getElementById("FIRSTURL")) {
        window.location.href = $("#FIRSTURL").attr("href");    
    }
}

function setImage(imgID,imgSRC) {$("#" + imgID).attr('src', imgSRC);}

function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} 
function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;} 

function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;} 
function posTop() {return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} 
function posRight() {return posLeft()+pageWidth();} 
function posBottom() {return posTop()+pageHeight();}

function CheckSiteWidth() {
    var pw = pageWidth();
    
    if (pw>=999) {
        //alert('adjusting');
        $("#ctl00_ContentPlaceHolder1_sitewidth").attr("style","width:1000px;border-right:2px solid #eeeeee;");
    } else {
        $("#ctl00_ContentPlaceHolder1_sitewidth").attr("style","width:1000px;");
    }
}
function HideAllBarsBut(divID) {
    for(i=1;i<=9;i++) {
        if(i!=divID) {
            animatedexpand.hide('WebDesign_' + i);
        }
    }
}
function ShowFlipBook (){
    var vid=document.getElementById("VIDEO");
    vid.style.display=(vid.style.display!="block")? "block" : "none"
    
    if (vid.style.display=="none") {
        $("#overlayBackground").remove();
        
    } else {
        var background = $('<div/>');
        $(background).attr("id", "overlayBackground").animate(
        {
            "opacity" : '.8'
        }, 1000).css(
        {
            "width" : $(document).width(),
            "height" : $(document).height()
        });
        
        $("body").append(background);
        $('body').append('</div>');
    }
    
    $("#VIDEO").fixedBox();
    
}

function filterInput(filterType, evt, allowDecimal, allowCustom){ 
    var keyCode, Char, inputField;
    var alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
    var num   = '0123456789'; 
    // Get the Key Code of the Key pressed if possible else - allow 
    if(window.event){ 
        keyCode = window.event.keyCode; 
        evt = window.event; 
    }else if (evt)keyCode = evt.which; 
    else return true; 
    // Setup the allowed Character Set 
    var filter = ""; 
    if(filterType == 0) filter = alpha; 
    else if(filterType == 1) filter = num; 
    else if(filterType == 2) filter = alpha + num; 
    if(allowCustom)filter += allowCustom;     
    //if(filter == '') return true; 
    // Get the Element that triggered the Event 
    inputField = evt.srcElement ? evt.srcElement : evt.target || evt.currentTarget; 
    // If the Key Pressed is a CTRL key like Esc, Enter etc - allow 
    if((keyCode==null) || (keyCode==0) || (keyCode==8) || (keyCode==9) || (keyCode==13) || (keyCode==27) )return true; 
    // Get the Pressed Character 
    Char = String.fromCharCode(keyCode); 
    // If the Character is a number - allow 
    if((filter.indexOf(Char) > -1)) return true; 
    // Else if Decimal Point is allowed and the Character is '.' - allow 
    else if(filterType == 1 && allowDecimal && (Char == '.') && inputField.value.indexOf('.') == -1)return true; 
    else return false; 
}

function ShowMedia(div,frm,url) {
    var vid=document.getElementById(div);
    var winwidth;
    var winheight;
    vid.style.display=(vid.style.display!="block")? "block" : "none"
    //alert(url);
    if (vid.style.display=="none") {
        $("#overlayBackground").remove();
        
    } else {
        var background = $('<div/>');
        $(background).attr("id", "overlayBackground").animate(
        {
            "opacity" : '.8'
        }, 1000).css(
        {
            "width" : $(document).width(),
            "height" : $(document).height()
        });
        
        $("body").append(background);
        $('body').append('</div>');
        
        winwidth = $(window).width() - 75;
        winheight = $(window).height() - 75;
        
        LoadFrame(frm,url);
    }
    if (winwidth<1160) {
        $("#" + div).height(winheight);
        $("#" + div).width(winwidth);
    }
    
    $("#" + div).fixedBox();
}

function LoadFrame(Frame,URL){
	$("#"+Frame).attr("src",URL);
}

function LoadFrameParent(Frame,URL){
	if (navigator.userAgent.indexOf("Firefox")>0){
	    parent.document.getElementById(Frame).src=URL;
	} else {
	    parent.document[Frame].location.href=URL;}
}
//END**************************************************************************

function SwitchOff(ANAME) { document.all.item(ANAME).style.display = 'none'; }
function SwitchOn(BNAME) { document.all.item(BNAME).style.display = ''; }

function ShowHide(CNAME) {
    var x = document.getElementById(CNAME);

    if (x) {
        if (x.style.display == 'none') {
            x.style.display = 'inline';
        } else {
            x.style.display = 'none';
        }
    }
}
function toggleFade(objid) {
    var sty = $("#" + objid).attr("style");
    if (sty) {
        if (sty.indexOf('none') > 0) { $("#" + objid).fadeIn(); } else { $("#" + objid).fadeOut(); }
    }
}
function setFrameParent(frme, url) {
    //alert('Setting Parent frame');
    if (navigator.userAgent.indexOf("Firefox") > 0) {
        parent.document.getElementById(frme).src = url;
        //alert('for FF');
    } else {
        parent.document[frme].location.href = url;
        //alert('for IE');
    }
}

function setFrame(frme, url) {
    //alert(url);
    if (navigator.userAgent.indexOf("Firefox") > 0) {
        document.getElementById(frme).src = url;
        //alert('for FF');
    } else {
        document[frme].location.href = url;
        //alert('for IE');
    }
}