var bolDOM = document.getElementById;
var bolSbmt = false;

var ie = document.all;
if(ie) {document.write('<link rel="stylesheet" type="text/css" href="includes/ie.css">');}
else {document.write('<link rel="stylesheet" type="text/css" href="includes/moz.css">');}

var flashvars = {};
var params = {};
var attributes = {};

function rollOverDiv(obj) {if(bolDOM) {document.getElementById(obj).className = obj + 'on';}}
function rollOutDiv(obj) {if(bolDOM) {document.getElementById(obj).className = obj + 'off';}}

function dispEmail() {eval(unescape("%79%66%6d%70%6b%30%34%3d%5b%27%25%36%63%25%36%39%25%37%33%25%36%31%27%2c%5b%27%25%36%33%25%36%66%25%36%64%27%2c%27%25%36%62%25%36%35%25%36%36%25%36%39%25%37%37%25%36%66%25%37%32%25%36%62%25%37%33%27%5d%2e%72%65%76%65%72%73%65%28%29%2e%6a%6f%69%6e%28%27%2e%27%29%5d%2e%6a%6f%69%6e%28%27%40%27%29%3b%66%77%6a%79%78%36%36%3d%75%6e%65%73%63%61%70%65%28%79%66%6d%70%6b%30%34%29%3b%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%66%77%6a%79%78%36%36%2e%6c%69%6e%6b%28%27%6d%61%69%27%2b%27%6c%74%6f%3a%27%2b%79%66%6d%70%6b%30%34%29%29%3b"));}
function dispContactUs() {eval(unescape("%62%66%65%64%6b%39%38%3d%5b%27%25%36%63%25%36%39%25%37%33%25%36%31%27%2c%5b%27%25%36%33%25%36%66%25%36%64%27%2c%27%25%36%62%25%36%35%25%36%36%25%36%39%25%37%37%25%36%66%25%37%32%25%36%62%25%37%33%27%5d%2e%72%65%76%65%72%73%65%28%29%2e%6a%6f%69%6e%28%27%2e%27%29%5d%2e%6a%6f%69%6e%28%27%40%27%29%3b%77%68%62%66%6e%37%37%3d%27%43%6f%6e%74%61%63%74%20%55%73%27%3b%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%77%68%62%66%6e%37%37%2e%6c%69%6e%6b%28%27%6d%61%69%27%2b%27%6c%74%6f%3a%27%2b%62%66%65%64%6b%39%38%29%29%3b"));}
function dispBetterIdea() {eval(unescape("%69%66%65%6b%66%34%36%3d%5b%27%25%36%63%25%36%39%25%37%33%25%36%31%27%2c%5b%27%25%36%33%25%36%66%25%36%64%27%2c%27%25%36%62%25%36%35%25%36%36%25%36%39%25%37%37%25%36%66%25%37%32%25%36%62%25%37%33%27%5d%2e%72%65%76%65%72%73%65%28%29%2e%6a%6f%69%6e%28%27%2e%27%29%5d%2e%6a%6f%69%6e%28%27%40%27%29%3b%63%69%7a%67%65%35%32%3d%27%61%20%62%65%74%74%65%72%20%69%64%65%61%27%3b%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%63%69%7a%67%65%35%32%2e%6c%69%6e%6b%28%27%6d%61%69%27%2b%27%6c%74%6f%3a%27%2b%69%66%65%6b%66%34%36%29%29%3b"));}

function dispInterTxt() {
	if(bolDOM) {
		document.getElementById('intertxt02').innerHTML = document.getElementById('intertxt01').innerHTML;
	}
}

function joinList() {
	if(!bolSbmt) {
		bolSbmt = true;
		
		if(chckEmail(document.webform.ea.value)) {
				document.webform.submit();		
		} else {alert('Please enter in a valid email address.'); bolSbmt = false;}
	}
}

function chckEmail(eml) {
	var intLen;
	var i; var j; var bolRet;
	
	i = 0; j = 0; bolRet = false;
	intLen = eml.length;
	while(i < intLen){ 
		if(j == 0) {if(eml.substr(i,1) == '@') {j = 1;}}
		if(j == 1) {if(eml.substr(i,1) == '.') {bolRet = true; break;}}
		i++;
	}
	
	return bolRet;
}

function dispKefiPop(type, vari) {
	var intPopWdth; var intOlnPad; var intTxtPad;
	var bolTemp;
	
	switch(type) {
		case "kfi":
		case "pic":
			intPopWdth = 550;
			intOlnPad = 10;
			intTxtPad = 15;
			break;
		case "gal":
			intPopWdth = 642;
			intOlnPad = 0;
			intTxtPad = 0;
			break;
		case "vid":
			intPopWdth = 576;
			intOlnPad = 0;
			intTxtPad = 0;
			break;
		default: break;
	}
	
	bolTemp = dispPopUp();
	if(bolTemp) {
		document.getElementById('popupbox').style.width = intPopWdth + 'px';
		document.getElementById('popupoline').style.padding = intOlnPad + 'px';
		document.getElementById('popuptxt').style.padding = intTxtPad + 'px';
		
		switch(type) {
			case "kfi":
				document.getElementById('popuptxt').innerHTML = '<div id="kefiworkslrg"></div><br />KEFI is a Greek word that essentially means passionate frenzy - so much desire that it can\'t be contained and must be expressed. Picture Anthony Quinn as Zorba the Greek smashing a plate in the middle of a cheering crowd, and you\'ve got the gist of Kefi.<br /><br />KefiWorks is a production company born out of the spirit of Kefi.<br /><br />An official plate smashing ceremony is in the works as we launch our maiden voyage, CIA IN TIBET.';
				break;
			case "pic":
				document.getElementById('popuptxt').innerHTML = '<img src="' + vari + '" border="0" width="500" alt="" />';
				break;
			case "gal":
				flashvars = {};
				params = {quality:"high", allowScriptAccess:"sameDomain", bgcolor:"#000000"};
				attributes = {};
				swfobject.embedSWF("slideshows.swf", "popuptxt", "642", "507", "8.0.0", false, flashvars, params, attributes);
				break;
			case "vid":
				flashvars = {id: vari, home: "false"};
				params = {quality:"high", allowScriptAccess:"sameDomain", bgcolor:"#000000"};
				attributes = {};
				swfobject.embedSWF("video.swf", "popuptxt", "576", "341", "9.0.115", false, flashvars, params, attributes);
				break;
			default: break;
		}
	}
}

function dispPopUp() {
	var objBody; var objDiv;
	
	if(bolDOM) {
		arrPageSize = getPageSize();
	
		objBody = document.getElementsByTagName('body').item(0);
		
		objDiv = document.createElement('div');
		objDiv.setAttribute('id', 'popupbgnd');
		objBody.insertBefore(objDiv, objBody.firstChild);
		
		objDiv.style.height = (arrPageSize[1] + 'px');
		
		objDiv = document.createElement('div');
		objDiv.setAttribute('id', 'popup');
		//objDiv.onclick = function() {delPopUp();}
		objBody.insertBefore(objDiv, objBody.firstChild);
		
		objDiv.style.height = (arrPageSize[1] + 'px');
		
		document.getElementById('popup').innerHTML = '<div id="popupbox"><div id="popupoline"><div id="popuptxt"></div></div><a href="javascript:delPopUp();"><div id="popupbttn"><img src="images/spacer.gif" border="0" width="40" height="11" alt="Close" /></div></a></div>';
	}
	
	return true;
}

function delPopUp() {
	var objBody; var objDiv;

	if(bolDOM) {
		objBody = document.getElementsByTagName('body').item(0);
		
		objDiv = document.getElementById('popupbgnd');
		objBody.removeChild(objDiv);
		
		objDiv = document.getElementById('popup');
		objBody.removeChild(objDiv);
	}
}

// from Lightbox JS (http://www.lokeshdhakar.com/projects/lightbox/)
// core code from quirksmode.org
function getPageSize() {
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight) {
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth) {	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
