var NewWindows;
var WinWidth = screen.width - 10;
var WinHeight = screen.height - 60;

function AbrirJanela(link) {
	var Feature
	if (is.ns4 ||is.ns6||is.mac) {
		WinFHeight = screen.height * 0.83;
	}
	if (is.ie4 || is.ie5 || is.ie6) {
		//WinFHeight = screen.height - 80;
		WinFHeight = screen.height * 0.85;
	}
	if (is.aol) {
		WinWidth = document.body.clientWidth + 145;
		WinHeight = document.body.clientheight;
		WinFHeight = screen.height - 160;
	}
	Feature = "fullscreen=yes,scrollbars=yes,width=" + WinWidth + ",height=" + WinHeight + ",top=0,left=0,location=no,resizable=yes"
	NewWindows = window.open("","Photo",Feature);
	NewWindows.focus();
	NewWindows.document.write("<a href='javascript:window.close()'><img name='show' src='" + link + "' height='" + WinFHeight + "'alt='Click to Close' border='0'></a>");
	NewWindows.document.close();
}  

function AbrirXLS(link) {
	var Feature
	if (is.ns4 ||is.ns6||is.mac) {
		WinFHeight = screen.height - 100;
	}
	if (is.ie4 || is.ie5 || is.ie6) {
		WinFHeight = screen.height - 80;
	}
	if (is.aol) {
		WinWidth = document.body.clientWidth + 145;
		WinHeight = document.body.clientheight;
		WinFHeight = screen.height - 160;
	}
	Feature = "fullscreen=no,scrollbars=yes,width=" + WinWidth + ",height=" + WinHeight + ",top=0,left=0,location=yes,resizable=yes"
	NewWindows = window.open(link,"XLS",Feature);
	NewWindows.focus();
}

function AbrirVideo(link) {
	var NewWindows;	
	var Feature;
	Feature = "fullscreen=no,location=no,scrollbars=yes,width=420,height=420,top=0,left=0,resizable=yes"
	NewWindows = window.open(link,"Video",Feature);
	//NewWindows.focus()
}

function AbrirVideoBig(link) {
	var NewWindows;	
	var Feature;
	Feature = "fullscreen=no,location=no,scrollbars=yes,width=720,height=560,top=0,left=0,resizable=yes"
	NewWindows = window.open(link,"Video",Feature);
	NewWindows.focus()
}

function barColor(Site) {
	if (document.all) {
		if (Site == "N") {
			document.body.style.scrollbarBaseColor = '#E7CBA5';
			}
		else if (Site == "L") {
			document.body.style.scrollbarBaseColor = '#E7CBA5';
		}
   }
}

function AbrirListURL(){
var URL = document.FormPageURL.ListPageURL.options[document.FormPageURL.ListPageURL.selectedIndex].value;
parent.list.location.href = URL;
//window.location.href = URL;
}

function printWindow() {
bV = parseInt(navigator.appVersion);
if (bV >= 4) window.print();
}

// this is for opening pop-up windows
function OpenPopup( url, name, openerUrl )
{
	var widgets = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=320,height=230";	var host = location.hostname;
	var popupWin = window.open( url, name, widgets );	popupWin.focus();

	if ( popupWin && popupWin.opener ) {
		if ( openerUrl )
		{
			popupWin.opener.location = openerUrl;
			popupWin.focus();
		}
		popupWin.opener.top.name = "opener";
	}
}

// New:

function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name, "", -1);
}

//<a href="javascript://" onclick="bgChange('bckGreenDark'); createCookie('isb_bck_prefs', 'bckGreenDark', 365);"><img src="http://www.altacal.com/images/spacer.gif" width="10" height="10" class="bckGreen" style="border: 1px solid #ccc;" alt="" /></a>/
function bgChange(bg) { document.body.className = bg; }

function styleChange(eTag, eID, clsName) {
    if (eID == '') {
        var pEle = getElementsByTagName(eTag).item[0];
        pEle.className = clsName;
    }
    else {
        var pEle = getElementsByID(eID);
        pEle.className = clsName;
    }

}

/***************/

var load = new Array;
var arrImg = new Array('default', 'about', 'news', 'how', 'clients', 'contact', 'web', 'print', 'code');
var absPath = "http://www.altacal.com/images/";


function preload_hdrs() {

    for (var i = 0; i < arrImg.length; i++) {
        load[i] = new Image();
        load[i].src = absPath + arrImg[i] + '.jpg';
    }

}
