﻿/* various javascripts */


window.onload = function() {
	// check to see that the browser supports the getElementsByTagName method
	// if not, exit the loop 
	if (!document.getElementsByTagName) {
		return false; 
	} 
	// create an array of objects of each link in the document 
	var popuplinks = document.getElementsByTagName("a");
	// loop through each of these links (anchor tags) 	
	for (var i=0; i < popuplinks.length; i++) {	
		// if the link has a class of "popup"...	
		if (popuplinks[i].className == "popup") {	
			// add an onclick event on the fly to pass the href attribute	
			// of the link to our second function, openPopUp 	
			popuplinks[i].onclick = function() {	
			openPopUp(this.getAttribute("href"));	
			return false; 	
			} 	
		}
	} 
} 

function openPopUp(linkURL) {
window.open(linkURL,'popup','width=400,height=400')
}


/* this will take the scrolled page to the top */
function takemeup() {
scrollTo(0,0);
}


/* popup larger images */
var popupwindow = 0;
function popUpImage(url, titlebar) {
var popupwindow = 0;
if (popupwindow.location && !popupwindow.closed) 
{ 
popupwindow.focus();
popupwindow.document.clear() 
} 
else 
{
popupwindow=window.open('','','width=480,height=560,resizable=1');
popupwindow.focus();
} 
popupwindow.document.writeln('<html> <head> <title>'+ titlebar +'<\/title> <\/head> <body onblur=\"self.close()\" bgcolor=\"silver\"><center>'); 
popupwindow.document.writeln('<img src=' + url + '>'); 
popupwindow.document.writeln('<a href=\"#\" onClick=\"javascript:self.close()\"><p style=\"font-family: Verdana, Arial, sans-serif; font-size: 10px; color: black;\">Close this window</p></a>');
popupwindow.document.writeln('<\/center>');
popupwindow.document.writeln('<\/body> <\/html>');  
popupwindow.document.close(); 
}

function closeMe() 
{
if (newwindow.location && !newwindow.closed) { newwindow.close(); } 
}

/* popup larger images */


function destroyPop() {
        if (popupwindow != '' && popupwindow.open) popupwindow.close();
}
window.onfocus=destroyPop; //destroys popupwindow on refocus the window


function openpopup(url){
var popurl=url
winpops=window.open(popurl,"","width=480,height=480,resizable,")
}


function Center(url,theWidth,theHeight){
var theTop=(screen.height/2)-(theHeight/2);
var theLeft=(screen.width/2)-(theWidth/2);
var aspects=
'height='+theHeight+',width='+theWidth+',top='+theTop+',left='+theLeft+",scrollbars=n";
theWin=window.open(url,'',aspects);
}


// function externalLinks() { 
//  if (!document.getElementsByTagName) return; 
//  var anchors = document.getElementsByTagName("a"); 
//  for (var i=0; i<anchors.length; i++) { 
//    var anchor = anchors[i]; 
//    if (anchor.getAttribute("href") && 
//        anchor.getAttribute("rel") == "external") 
//      anchor.target = "_blank"; 
//  } 
// } 
// window.onload = externalLinks;

//--------------------------------
// This code compares two fields in a form and submit it
// if they're the same, or not if they're different.
//--------------------------------

function checkEmail(theForm) {
    if (theForm.email.value != theForm.email_2.value)
    {
        alert('Sorry, your emails don\'t match!');
        return false;
    } else {
        return true;
    }
}

// this will allow the selection from quicklinks

function go()
{
	box = document.forms[0].full_list;
	destination = box.options[box.selectedIndex].value;
	location.href = destination;
}

function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

