/*
cross browser popup win
http://www.quirksmode.org/js/popup.html
http://www.quirksmode.org/js/croswin.html

*/

var newwindow = '';

function popup(url,s,w,h) {
	if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
	}
	else {
		newwindow=window.open(url,'closeup','status=no,dependent=yes,location=no,menubar=no,toolbar=no,scrollbars='+s+',resizable=yes,width='+w+',height='+h);
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus()}
	return false;
}


/*
Email Clocking

hide from spam bots
http://www.badboy.ro/articles/2005-01-25/index.php

<span class="emailCloak">name(at)server.com</span>

need to implement onload
window.onload = emailCloak;
*/

function emailCloak() {
	if (document.getElementById) {
		var alltags = document.all? document.all : document.getElementsByTagName("*");
		for (i=0; i < alltags.length; i++) {
			if (alltags[i].className == "emailCloak") {
			  	var oldText = alltags[i].firstChild;
			  	var emailAddress = alltags[i].firstChild.nodeValue;
			  	var user = emailAddress.substring(0, emailAddress.indexOf("("));
			  	var website = emailAddress.substring(emailAddress.indexOf(")")+1, emailAddress.length);
			  	var newText = user+"@"+website;
			  	var a = document.createElement("a");
			  	a.href = "mailto:"+newText;
				var address = document.createTextNode(newText);
				a.appendChild(address);
				alltags[i].replaceChild(a,oldText);
			  }
			}
		}
}

//=====================================================================
//  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'))
			}
		}
	}
}

/*
PNG fix for IE6
needs mootoools v1+
http://og5.net/~wusch/?cat=javascript
*/
/*
var Png = new Class({
	initialize: function(){
		var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
		if((rslt != null && Number(rslt[1])>=5.5 && Number(rslt[1])<7))
			$S('.png').each(function(el){
				var pos = $(el).getCoordinates();
				$(el).clone().setStyles({
					'background': '',
					'width': pos.width+"px",
					'height': pos.height+"px",
					'left': pos.left+"px",
					'top': pos.top+"px",
					'position': 'absolute'
				}).injectInside('body');
				$(el).setStyles({
					'width': pos.width+"px",
					'height': pos.height+"px",
					'background': '',
					'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.currentStyle.backgroundImage.substring(5, el.currentStyle.backgroundImage.length-2)+"', sizingMethod='crop')"
				}).setHTML('');
				el.addEvent("propertychange", function(){
					if(window.event.propertyName=="style.backgroundImage"){
						var el = window.event.srcElement;
						if($(el).hasClass('png'))
							el.filters.item(0).src = el.currentStyle.backgroundImage.substring(5,el.currentStyle.backgroundImage.length-2);
					}
				});
			});
	}
});*/

