﻿
//----------- Get A DOM Object By Regular Expression and TagName ----------//

// get a single dom object

function getSingleDomObj(tagName, regexp)
{
    var i;
    var found = false;
    var domObj;
    var tagArray = document.getElementsByTagName(tagName);

    for (i = 0; i < tagArray.length && found == false; i++)
    {
        if (regexp.test(tagArray[i].getAttribute("ID")))
        {
            domObj = tagArray[i];
            found = true;
        }
    }
    return domObj;
}

//get an array of objects of the same type

function getAllDomObjects(tagName, regexp)
{
    var i,j;
    var found = false;
    var domObjArr = new Array();
    var tagArray = document.getElementsByTagName(tagName);

    for (i = 0, j = 0; i < tagArray.length; i++)
    {
        if (regexp.test(tagArray[i].getAttribute("ID")))
        {
            domObjArr[j] = tagArray[i];
            j++;
        }
    }
    return domObjArr;
}

//------------------------------- Opacity --------------------------------//

//change the opacity of any object that is transfered as a parameter

function OpacAnyObj(obj, opacityValue)
{
    if (typeof document.body.style.opacity != 'undefined')//FF 
    {
        obj.style.opacity = opacityValue / 100;
    }
    else if (typeof document.body.style.filter != 'undefined') //IE
    {
        obj.style.filter = "alpha(opacity=" + opacityValue + ")";
    }
}

// change the opacity of the large image. the table containing the large image is
// global variable and we get its reference directly

function OpacLargeImage(opacityValue)
{
    if (largeImagesTableObj != 'undefined')
    {
        getWhiteTable();
        obj = largeImagesTableObj;
    }

    if (typeof document.body.style.opacity != 'undefined')//FF 
    {
        obj.style.opacity = opacityValue / 100;
    }
    else if (typeof document.body.style.filter != 'undefined') //IE
    {
        obj.style.filter = "alpha(opacity=" + opacityValue + ")";
    }
}

//--------------------------------- Get Page Dimensions -------------------------------//

// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well

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;
}

//--------------------------- Contact Page -----------------------------------//

function clearText(obj)
{
    obj.innerHTML = " ";
}

function changeColor(obj)
{
    obj.style.color = "#232345";
}

function checkEmail(obj)
{
    if (obj.innerHTML == "your email")
    {
        obj.innerHTML = "your message will be sent without an email";
    }
}

//------------------------- functions for underlining the categories menu -------------------//

// these are styling functions trigerred in the browser events onmouseover and onmouseout

function showULine(obj)
{
    var color = "#ababcd"; //"#c3c3e5";
    var width = "2px";
    var type = "solid";
    obj.style.borderBottom = color + " " + width + " " + type;
}

function whitenULine(obj)
{
    var color = "#ffffff";
    var width = "2px";
    var type = "solid";
    obj.style.borderBottom = color + " " + width + " " + type;
}

