﻿function addKeyDownHandler(source, callback){
	nn=(document.layers)?true:false; 
	ie=(document.all)?true:false; 

	source.onkeydown=callback; 
	if(nn) document.captureEvents(Event.KEYDOWN);
}

function addKeyUpHandler(source, callback){
	nn=(document.layers)?true:false; 
	ie=(document.all)?true:false; 

	source.onkeyup=callback; 
	if(nn) document.captureEvents(Event.KEYUP);
}

function addKeyPressHandler(source, callback){
	nn=(document.layers)?true:false; 
	ie=(document.all)?true:false; 

	source.onkeypress=callback; 
	if(nn) document.captureEvents(Event.KEYPRESS);
}

function isKeyPressed(e, charCode) { 
	var evt=(e) ? e :(window.event)? window.event:null; 
	if (evt) { 
		var key=(evt.charCode) ? evt.charCode : ((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0)); 
		return key==charCode; 
	} 
}

function blockEnterKey(sourceControl){
	addKeyPressHandler(sourceControl, enterKeyPressBlocker);
}

function enterKeyPressBlocker(e){
	if (isKeyPressed(e, '13')){
		return false;
	}
}


function sendEvent(swf,typ,prm) { 
   thisMovie(swf).sendEvent(typ,prm); 
};

function getUpdate(typ,pr1,pr2,swf) {
};

function thisMovie(swf) {
  if(navigator.appName.indexOf("Microsoft") != -1) {
    return window[swf];
  } else {
    return document[swf];
  }
};


function showImage(img)
{
   document.getElementById(img).style.display = "block";
}
        
function hideImage(img)
{
   document.getElementById(img).style.display = "none";
}
    
 
function setResponseHtmlEvents(pUrl, pDiv) 
{
        var container = $('#' + pDiv); 
        
        container.css({top: 0});
        container.animate({opacity:'0'}, 500, "easeOutBack", function(){
        container.html("");
        container.append('<div class="innerdiv" id="innerdiv"></div>');
            
            
        $("#innerdiv").load(pUrl, function(){
                    
                    container.animate({ opacity: '1'}, 700, "easeInBack");
                    
               }); 
            
        });
    
    
  

}






$.extend({
    getUrlVars: function() {
        var vars = [], hash;
        var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
        for (var i = 0; i < hashes.length; i++) {
            hash = hashes[i].split('=');
            vars.push(hash[0]);
            vars[hash[0]] = hash[1];
        }
        return vars;
    },
    getUrlVar: function(name) {
        return $.getUrlVars()[name];
    }
});



var isBusy = false;
var container;
var scrollbarbgtop;
var scrollbarbgbottom;
var dynamicBoxContent;
var winW;
var winH;



function getBrowserDimensions() {
    if (parseInt(navigator.appVersion) > 3) {
        if (navigator.appName == "Netscape") {
            winW = window.innerWidth;
            winH = window.innerHeight;
        }

        if (navigator.appName.indexOf("Microsoft") != -1) {
            winW = document.body.offsetWidth;
            winH = document.body.offsetHeight;
        }
    }
}



function findPosX(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
        do {
            curleft += obj.offsetLeft;
            curtop += obj.offsetTop;
        } while (obj = obj.offsetParent);
        return curleft;
    }
}


function findPosY(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
        do {
            curleft += obj.offsetLeft;
            curtop += obj.offsetTop;
        } while (obj = obj.offsetParent);
        return curtop;
    }
}


function setResponseHtml(pUrl, pDiv) {
    window.location = pUrl;
}
 

