﻿var clientid;

function fnSetFocus(txtClientId)
{
	clientid=txtClientId;
	setTimeout("fnFocus()",1000); 
}

function fnFocus()
{
    eval("document.getElementById('"+clientid+"').focus()");
}

function clearValidationError(id){
    if(document.getElementById(id)){
        document.getElementById(id).style.display = "none";
    }
}

function showElement(id){
    document.getElementById(id).style.display = "";
}

function hideElement(id){
    document.getElementById(id).style.display = "none";
}

function openTutorial(url){
    window.open(url,'tutorialwindow','width=1200,height=735,toolbar=no, location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no, resizable=yes');
}

var globalElementId
var globalDelayId

function swapSupport(obj, elementId){
    var elem = document.getElementById(elementId);
    elem.style.left = findPosX(obj) + "px";
    elem.style.top = (findPosY(obj) + 12) + "px";
    if(elem.style.display == "none"){
        showElement(elementId);
        globalElementId = elementId;
        globalDelayId = setTimeout(swapSupportDelayedHide, 20000);
    }
    else{
        hideElement(elementId);
    }
}

function doSearch(sender,e)
{
    document.getElementById("ctl00_BoxSearch1_ButtonSearch").click();
}

function doSearch2(sender,e)
{
    document.getElementById("ctl00_ContentPlaceHolder1_ButtonSearch").click();
}

function swapSupportDelayedHide(){
    hideElement(globalElementId);
    clearTimeout(globalDelayId); 
}

function findPosX(obj)
{
    var curleft = 0;
    if(obj.offsetParent){
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    }
    else if(obj.x) curleft += obj.x;
    return curleft;
}

function findPosY(obj)
{
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
}
