function roll(id){

   var objSrc = id.src;
   var ext = (objSrc.indexOf(".jpg") != -1) ? ".jpg" : ".gif";
   var idLength = objSrc.length;

   if(objSrc.indexOf("_over") != -1){
      var path = objSrc.substr(0, idLength - 9);
      id.src = path + ext;
   } else {
      var path = objSrc.substr(0, idLength - 4);
      id.src = path + "_over" + ext;
   }

}


function setSolution(id, num){
	for(var i=1; i<=num; i++){
		document.getElementById('solution' + i).style.display = "none";
	}

	document.getElementById('solution' + id).style.display = "block";
}
	

function openWin(file, winName,wide,high,scroll){

	var screenX = screen.availWidth;
	var screenY = screen.availHeight;

	var posX = (screenX - wide)/2;
	var posY = (screenY - high)/2;

	win = window.open(file,winName,"screenX="+posX+",screenY="+posY+",top="+posY+",left="+posX+",height="+high+",width="+wide+",fullscreen=0,location=0,menubar=0,resizable=0,scrollbars="+scroll+ ",status=0,toolbar=0");
		
	if (window.opener == null) window.opener = self;

}


function isEmailValid(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.length > 0){
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }
	}		
	return true					
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}