
//change mouseover/mouseout on project page images
function myFilter(which, state){
	if(state == 'true'){
		which.style.filter = 'progid:DXImageTransform.Microsoft.Alpha( Opacity=75, FinishOpacity=0, Style=1, StartX=100,  FinishX=100, StartY=100, FinishY=100)';
	}else{
		which.style.filter = state;
	}
}

//show modal  window
function modalWin(pagename, pgwidth, pgheight) {
	if (window.showModalDialog) {
		window.showModalDialog(pagename,'',"dialogHeight: "+pgheight+"px; dialogWidth: "+pgwidth+"px; dialogTop: px; dialogLeft: px; edge: sunken; center: Yes; resizable: No; status: No; unadorned: No;");
	} else {
		window.open(pagename,'','height='+pgheight+',width='+pgwidth+', toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no ,modal=yes');
	}
} 

function showPic (whichpic) {
	if (document.getElementById) {
		document.getElementById('placeholder').src = whichpic.href;
		/*if (whichpic.title) {
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
		} else {
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
		}*/
		return false;
	} else {
		return true;
	}
}


/*function addEvent( obj, type, fn )
{
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function removeEvent( obj, type, fn )
{
	if (obj.removeEventListener)
		obj.removeEventListener( type, fn, false );
	else if (obj.detachEvent)
	{
		obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
		obj["e"+type+fn] = null;
	}
}*/

//contact form validation
function checkInput()
{

	if (document.contactform.name.value == ""){
		alert("Please enter your Name");
		document.contactform.name.focus();
		return;
	}
	
	if (document.contactform.email.value == ""){
		alert("Please enter your Email Address");
		document.contactform.email.focus();
		return;
	}
	
	if (document.contactform.email.value!=""){
		var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
		var check=/@[\w\-]+\./;
		var checkend=/\.[a-zA-Z]{2,4}$/;  
		if(((document.contactform.email.value.search(exclude) != -1) || (document.contactform.email.value.search(check)) == -1) || (document.contactform.email.value.search(checkend) == -1)){              
			alert("Invalid Email address!");   
			document.contactform.email.focus()
			return;   
		}       
	}	
	
	if (document.contactform.subject.value == ""){
		alert("Please enter your reason for inquiry");
		document.contactform.subject.focus();
		return;
	}		
	
	if (document.contactform.comments.value == ""){
		alert("Please enter your comment");
		document.contactform.comments.focus();
		return;
	}
	
	//alert("All good");
	document.contactform.submit();
}