// JScript File

function OpenDoc(vDoc, iWidth, iHeight, iLeft, iTop)
{
    window.open (vDoc,null, "height=" + iHeight + ",width=" + iWidth + ",left=" + iLeft + ",top=" + iTop + ",status=yes,toolbar=no,menubar=no,resizable=yes");
}
//Window ID can be used to prevent multiple instances.


function DocWrite(text){
    document.write(text);
}

function HTMLDecode(encodedText){
    return encodedText.replace(/&lt;/gi,'<').replace(/&gt;/gi,'>').replace(/&qu;/gi,'"').replace(/&quot;/gi,'"').replace(/&#39;/gi,'\'').replace(/&amp;/gi,'&');
}

function registerDefaultText(control, text){
        
    if (control.value == text){
        control.className = "empty";
    } else {
        control.className = "filled";
    }
    control.initialValue = text;

    control.onclick = control.onfocus = function(){
        this.className = "filled";
        if(this.value == this.initialValue){
            this.value= "";
        }
    }
        
     control.onblur = function(){
        if(this.value == this.initialValue || this.value == ""){
            this.className = "empty";
            this.value = this.initialValue;
        }else{
            this.className = "filled";
        }
    }
}

addLoadEvent(fixBQs);

function fixBQs(){
    changeBlockquotes(window.document)
}
function changeBlockquotes(node){
    
    if (node.nodeName.toLowerCase() == 'blockquote'){
    
        var needWrapper = new Array();

        for (var i = 0; i < node.childNodes.length; i++){
            var c = node.childNodes[i];
            if (c.nodeName.toLowerCase() == "cite")  break;
            needWrapper.push(c);
        }    
        
        var wrapper = document.createElement("div");
        wrapper.setAttribute("className","blockquoteHelper");
        wrapper.setAttribute("class","blockquoteHelper");
        
        if (node.firstChild == undefined)
            node.appendChild(wrapper);
        else
            node.insertBefore(wrapper,node.firstChild);        

        for (var i = 0; i < needWrapper.length; i++){
            wrapper.appendChild(node.removeChild(needWrapper[i]));
        }

    }
    
    var a = node.childNodes;
    for (var i = 0; i < a.length; i++){
        changeBlockquotes(a[i]);
    }
   
    
}

function addLoadEvent(func){
    var oldonload = window.onload;
    if(typeof window.onload != 'function'){
        window.onload = func;
    }else{
        window.onload = function(){
            oldonload();
            func();
        }
    }
}

function deleteNode(node){
    node.parentNode.removeChild(node);
}
function deleteById(id){
    var node = document.getElementById(id);
    deleteNode(node);
}
function deleteChildFlashById(id){
    var node = document.getElementById(id);
    return deleteChildFlash(node);
}
function deleteChildFlash(node){
   if (node.nodeName.toLowerCase() == 'embed' || node.nodeName.toLowerCase() == 'object'){
        deleteNode(node);
        return true;
   }
    var a = node.childNodes;
    var foundObjects = false;
    for (var i=0; i < a.length; i++){
        if (deleteChildFlash(a[i])) foundObjects = true;
    }
    return foundObjects;
}
function stopChildFlashById(id){
    var node = document.getElementById(id);
    return stopChildFlash(node);
}
function stopChildFlash(node){
   if (node.nodeName.toLowerCase() == 'embed' || node.nodeName.toLowerCase() == 'object'){
        node.StopPlay();
        return true;
   }
    var a = node.childNodes;
    var foundObjects = false;
    for (var i=0; i < a.length; i++){
        if (stopChildFlash(a[i])) foundObjects = true;
    }
    return foundObjects;
}