/* -----------------------------------------------------------------------------------------
Custom Created Funcitons by Xynergy Inc.
----------------------------------------------------------------------------------------- */

function rollover(id, type, graphic)
{
	document.getElementById(id).src = '/graphics/' + id + '-on.' + type;
}

function rollout(id, type, graphic)
{
	document.getElementById(id).src = '/graphics/' + id + '-off.' + type;
}

function imageover(id)
{
	document.getElementById('large').src = '/photos/' + id + '-lg.jpg';
}

function imageout(id)
{
	document.getElementById('large').src = '/photos/' + id + '.jpg';	
}



/* -----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------- */
   
/* 
* Generated by Macromedia's Fireworks when 
* creating Rollover Menus, 
* not a proprietary Xynergy Technology
*/

// finds necessary image objects.
// this function is only called in swapImage()
function findObj(n, d) 
{ //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// switches the image for the 'over state' of a navigation element
function swapImage() 
{ //v3.0
	var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// restores the default image when the mouse leaves a navigation element.
function swapImgRestore() 
{ //v3.0
	var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


// preloads necessary rollover images.
function preloadImages() 
{ //v3.0
	var d=document; if(d.images){ if(!d.p) d.p=new Array();
	var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}


/* -----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------- */

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;

/* -----------------------------------------------------------------------------------------
Image Protection [added by Javier 11/08/07]
----------------------------------------------------------------------------------------- */

var specialcase = ((navigator.userAgent.indexOf('Mac') != -1) || document.all)
var flag = 0;
var msg = 'This image is protected by copyright.\nWe kindly request you not to copy it.';
var x,y,x1,y1,copyAttempt;
if(window.Event){
	document.captureEvents(Event.MOUSEMOVE);
}

function init()
{
	if (!(document.getElementById || document.all || document.layers)) return;
	if (specialcase && document.layers)
	{
		document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = special;
	}
	for (i=0;i<document.images.length;i++)
	{
		document.images[i].onmousedown = checkIt;
		document.images[i].onmouseup = function() {return false};
		if (specialcase)
		{
			document.images[i].onmousemove = special;
			document.images[i].onclick = clearIt;
		}
	}
}

function checkIt(e){
	copyAttempt = 0;
	if (window.event){
		x = window.event.clientX;
		y = window.event.clientY;
		theButt = (window.event.button > 1);
	}
	else if(e)	{
		x = e.screenX;
		y = e.screenY;
		theButt = (e.which > 1);
	}
	if (theButt){
		copyAttempt = 1;
		flag = 0;
		//catch mozilla menu
		d = new Date() //today's date
		while (1){
		mill=new Date() // Date Now
		diff = mill-d //difference in milliseconds
		if( diff > 350 ){
			break;
		}
	}
		alert(msg);
		return false; // NN4 only
	}
	if (specialcase) flag = 1;
	return false;
}

function special(e){
	theObj = '';
	if (window.event){
		x1 = window.event.clientX;
		y1 = window.event.clientY;
		theObj = window.event.srcElement.parentElement.tagName;
	}
	else if(e){

		x1 = e.screenX;
		y1 = e.screenY;
		if (e.target.parentNode) theObj = e.target.parentNode.tagName;
	}
	//var isLink = (theObj == 'A');
	if (flag && ((Math.abs(x-x1) > 20) || (Math.abs(y-y1) > 20))){
		copyAttempt = 1;
		flag = 0;
		alert(msg);
		return false;
	}
}

function clearIt(){
	flag = 0;
	if (copyAttempt){
		copyAttempt = 0;
		return false;
	}
}
