/*
function handpointer(src) {
	if (navigator.appName.indexOf("Internet Explorer") == -1) {
		src.style.cursor = "pointer";
	} else {
		src.style.cursor = "hand";
	}
}
*/
function openwin(popurl, ww, hw) {
	var newWin;
	if (ww=="") {ww = 330; }
	if (hw=="") {hw = 590; }
	newWin = window.open(popurl, 'image','width='+ww+', height='+hw+', scrollbars=yes, resizable=yes');
	newWin.focus();		
} 

//<![CDATA{
function myOnSubmitEventHandler() {
	try {
		document.getElementById('editor1').EscapeUnicode = true;
		document.getElementById('xhtml1').value = document.getElementById('editor1').value;		
	}
	catch(er) {
		document.getElementById('xhtml1').value = document.getElementById('alternate1').value;
	}
}
//]]>

function docwin(where) {
	myWindow = window.open (where, 'calwin', 'width=350, height=250, toolbar=no, location=no, scrollbars, resizable, status=yes');
	myWindow.focus();
}

//document.getElementById("expandable").style.display = "none";

function toggle(toggler) {
	if(document.getElementById) {
		targetElement = toggler.parentNode.nextSibling;
		//alert("Target: " + targetElement.className);
		if(targetElement.className == undefined) {
			targetElement = toggler.parentNode.nextSibling.nextSibling;				
		}	

		if (targetElement.style.display == "block") {
			targetElement.style.display = "none";
		} else {
			targetElement.style.display = "block";
		}
	} 
}

function swap(targetId,buttonId,path) {  
  	if (document.getElementById) {
        target = document.getElementById(targetId);
        buttonName = document.getElementById(buttonId);
        
        if (target.style.display == "none") {
            target.style.display = "";
        } else {                
            target.style.display = "none";
        }
        
        if (document.getElementById(buttonId) != undefined) {   
	        if (target.style.display == "none") {
	            buttonName.src = path + "img/more.gif";
	            buttonName.alt = "View more details";
	        } else {
	            buttonName.src = path + "img/less.gif";
	            buttonName.alt = "Hide details";
	        }
        }
        aa=255;
        colorfade(targetId);  
  	}
}

function swapPhoto(photoSRC) {
    document.images.imgPhoto.src = "./gallery/" + photoSRC;
    scrollTo(0,0);
}

function isEmail(inputStr) {
	var supported = 0;
	if (window.RegExp){
		var tempStr = "a";
		var tempReg = new RegExp(tempStr)
		if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported)
		return (inputStr.indexOf(".") > 2) && (inputStr.indexOf("@") > 0);
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,4})(\\]?)$"); 
	return (!r1.test(inputStr) && r2.test(inputStr));
}

function colorfade(tId) {
	if(aa>0) {
		// aa color value. Decreasing by 5 units. 
		aa -=5;
//alert ("ID:" + tId);
		// Sets the color value. 
		document.getElementById(tId).style.color="rgb("+aa+","+aa+","+aa+")";

		// Call colorfade again...
		setTimeout("colorfade('"+tId+"')",20);	
	} 
}