﻿function isString(obj)
{ 
    if (typeof(obj) == 'string')
    {
        return true; 
    }
    else if (!obj)
    { 
        return false; 
    }
    else if ((typeof(obj) == 'object') && obj.toLowerCase) 
    { 
        return true; 
    } 
    return false; 
} 
function isUndefined(obj) 
{
    return typeof(obj) == 'undefined';
}
function isFunction(obj) 
{
    return typeof(obj) == 'function';
}
function isObject(obj)
{
    return (typeof(obj) == 'object' && !obj) || isFunction(obj);
}
function isNumber(obj) 
{
    return typeof(obj) == 'number' && isFinite(obj);
}
function isNull(obj) 
{
    return typeof(obj) == 'object' && !obj;
}
function isBoolean(obj) 
{
    return typeof(obj) == 'boolean';
}
function isIEObject(obj) 
{
    return isObject(obj) && typeof(obj.constructor) != 'function';
}
function isArray(obj) 
{
    return isObject(obj) && obj.constructor == Array;
}
function openWindow(page,width,height)
{
    window.open(page,'popup','top=50,left=50,width='+width+',height='+height+',resizable=0,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0');
}
function openScrollWindow(page,width,height)
{
    window.open(page,'popup','top=50,left=50,width='+width+',height='+height+',resizable=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0');
}

function swapNav(obj, classname)
{
    obj.className = classname;
}
function swapImg(obj, img)
{
    var strOn = "_on.gif";
    var strOff = ".gif";
    var strSource = obj.src;
    strSource = (strSource.indexOf(strOn) > -1) ? strSource.replace(strOn, strOff) : strSource.replace(strOff, strOn);
    obj.src = strSource;
}
function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}

function WriteFlash(url, width, height, bgc)
{
    if (bgc == null) bgc = "transparent";

    if (url == null && width == null && height == null)
    {
        document.write("<br/><div style='color: red;'><b>***</b> WriteFlash function requires flashname, width and height parameters at least!</div>");
    } 
    else 
    {    
        document.write("<object type='application/x-shockwave-flash' data='"+url+"' width='"+width+"' height='"+height+"' align='center'>");
        document.write("<param name='movie' value='"+url+"' />");
        document.write("<param name='allowScriptAcess' value='sameDomain' />");
        document.write("<param name='quality' value='best' />");
        document.write("<param name='scale' value='noScale' />");
        document.write("<param name='salign' value='TL' />");
        document.write("<param name='FlashVars' value='playerMode=embedded' />");
        document.write("<param name='wmode' value='transparent' />"); 
       // document.write("<param name='BackgroundColor' value='"+bgc+"' />"); 
        document.write("</object>");               
    }
}