// START JQUERY
var GB_ANIMATION = true;
$(document).ready(function(){
	$("a.greybox").click(function(){
		var t = this.title || this.innerHTML || this.href;
		GB_show(t,this.href,700,600);
		return false;
	});
	$("a.popper").click(function(){
		var t = this.title || this.innerHTML || this.href;
		winpop(this.href,800,700);
		return false;
	});
	$("a.popscroller").click(function(){
		var t = this.title || this.innerHTML || this.href;
		winpopscroller(this.href,700,600);
		return false;
	});
});
// END JQUERY

// RANDOM VARIABLES
function randomizer(total) {
	today = new Date();
	jran_one = today.getTime();
	var number = total;
	var random_one = "";
	ia = 9301;
	ic = 49297;
	imq = 233280;
	jran_one = (jran_one*ia+ic) % imq;
	random_one = Math.ceil( (jran_one/(imq*1.0)) * number);
	return random_one;
}

// SHUFFLE ARRAY
function shuffler(o) {
	for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
	return o;
};
	
// MAILTO FUNCTION
function mailto(username,hostname,linktext) {
	document.write("<a href=" + "mail" + "to:" + username + "@" + hostname + ">" + linktext + "</a>");
}

// WINDOW POP-OFF FUNCTION
function winpop(url,width,height) {
	wh = "width="+width+",height="+height+",scrollbars=yes";
	window.open(url,'newwin',wh);
}

// WINDOW POP-OFF FUNCTION
function winpopscroller(url,width,height) {
	wh = "width="+width+",height="+height+",scrollbars=yes";
	window.open(url,'newwin',wh);
}

// WINDOW POP-UNDER FUNCTION
function winpopunder(url,width,height) {
	wh = "width="+width+",height="+height+",scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0";
	newPopUnder = window.open(url,'externalwin',wh);
	newPopUnder.blur()
	window.focus()
}

// FLASH MOVIE
function loadFlash(source,width,height) {
	var swfCode;
	swfCode = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + width + '" height="' + height + '">';
	swfCode += '	<param name="allowScriptAccess" value="sameDomain" />';
	swfCode += '	<param name="movie" value="' + source + '" />';
	swfCode += '	<embed src="' + source + '" width="' + width + '" height="' + height + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"" />';
	swfCode += '<'+'/object>';
	document.write(swfCode);
}

// QUICKTIME CODE
function loadQuicktime(source,width,height,autoplay) {
	var qtCode;
	height = height + 16; // add 16px for controls
	qtCode = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="' + width + '" height="' + height + '" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0">';
	qtCode += '<param name="src" value="' + source + '"></param>';
	qtCode += '<param name="controller" value="true"></param>';
	qtCode += '<param name="type" value="video/quicktime"></param>';
	qtCode += '<param name="autoplay" value="' + autoplay + '"></param>';
	qtCode += '<param name="target" value="myself"></param>';
	qtCode += '<param name="bgcolor" value="#000000"></param>';
	qtCode += '<param name="pluginspage" value="http://www.apple.com/quicktime/download/indext.html">';
	qtCode += '<embed src="' + source + '" width="' + width + '" height="' + height + '" controller="true" autostart="' + autoplay + '" target="myself" type="video/quicktime" bgcolor="#000000" border="0" pluginspage="http://www.apple.com/quicktime/download/indext.html"></embed>';
	qtCode += '</object>';
	document.write(qtCode);
}

//=====================================================================
//  DOM Image Rollover v3 (hover)
//
//  Demo: http://chrispoole.com/scripts/dom_image_rollover_hover
//  Script featured on: Dynamic Drive (http://www.dynamicdrive.com)
//=====================================================================
//  copyright Chris Poole
//  http://chrispoole.com
//  This software is licensed under the MIT License 
//  <http://opensource.org/licenses/mit-license.php>
//=====================================================================
function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf('domroll')!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			imgClass[i]=imgarr[i].className;
			imgPreload[i]=new Image();
			if (imgClass[i].match(/domroll (\S+)/)) {
				imgPreload[i].src = imgClass[i].match(/domroll (\S+)/)[1]
			}
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}
		}
	}
}
domRollover();