﻿// JScript File
function showhide(obj,ctrlname)
{
    for(var i=0;i<obj.childNodes.length;i++)
    {
        var ctrl = obj.childNodes[i];
        if(ctrlname == ctrl.id)
        {
            ctrl.className = ((ctrl.className == "hide") ? "show":"hide");
        }
    }    
}

function SelectImage(idcontrol,id,pathcontrol,path)
{
    if(window.opener!=null)
    {
        var obj = window.opener.document.getElementById(idcontrol);
        if(obj)
            obj.value = id;
        
        obj = window.opener.document.getElementById(pathcontrol);
        var s = obj.src.toLowerCase();
        var e = s.substring(s.length - 4);
        if(e == ".jpg" || e == ".gif" || e == ".bmp")
            s = s.substring(0,s.lastIndexOf("/") + 1);
        if(obj)
            obj.src = s + path;
    }
    window.close();
}
function ResetImage(idcontrol,imagecontrol)
{
    Reset(idcontrol,imagecontrol);
}
function Reset(idcontrol,imagecontrol)
{
    var obj = document.getElementById(idcontrol);
    var img = document.getElementById(imagecontrol);
    if(obj != null && img != null)
    {
        obj.value = "";
        img.src = "";
    }
}
function ResetLogo(idcontrol,imagecontrol)
{
    Reset(idcontrol,imagecontrol);
}
function ResetDocument(idcontrol,doccontrol)
{
    var obj = document.getElementById(idcontrol);
    var doc = document.getElementById(doccontrol);
    if(obj && doc)
    {
        obj.value = "";
        doc.src = "";
    }
}
function OpenWin(url)
{
    window.open(url,null,'height=600;width=450,titlebar=no,toolbar=no,status=no,resizable=yes,menubar=no,locationbar=no,scrollbars=yes');
}
function showflash(show,hide)
{
    var flashinstalled = false;
    var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0);
    flashinstalled = ((plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 4)?true:false);
    var obj1= document.getElementById(show);
    var obj2= document.getElementById(hide);
    flashinstalled = false;
    if(flashinstalled)
    {
       obj1.style.display = "block";
       obj2.style.display = "none";
    }
    else
    {
       obj1.style.display = "none";
       obj2.style.display = "block";
    }
}
function highlight(objname)
{
    var obj = document.getElementById(objname);
    if(obj)
        obj.className = "lnkcurrent";
}

var imgCounter = 0;
function prevImage(imageid)
{
    if(document.getElementById("imgURLs") == null)
        return;
    
    var imgurls = (document.getElementById("imgURLs")).value;
    imgurls = imgurls.split("`");
    if(imgurls.length > 0 && ((imgCounter-1) >= 0 ) )
    {
        var objimg = document.getElementById(imageid);
        var path = imgurls[imgCounter-1];
        if(path.length > 0 && objimg != null)
        {
            objimg.src=path;
            imgCounter--;
        }
    }
}
function nextImage(imageid)
{
    if(document.getElementById("imgURLs") == null)
        return;
    
    var imgurls = (document.getElementById("imgURLs")).value;
    imgurls = imgurls.split("`");
    if(imgurls.length > 0 && ((imgCounter+1) < imgurls.length) )
    {
        var objimg = document.getElementById(imageid);
        var path = imgurls[imgCounter+1];
        if(path.length > 0 && objimg != null)
        {
            objimg.src=path;
            imgCounter++;
        }
   }
}