function doEmail(pStr)
{
	var reEmail = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
	if (reEmail.test(pStr)) {
		return true;
	} else if (pStr != null && pStr != "") {
		return false;
	}
} // doEmail

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}


function nextImage(){
	if((imagePosition+1) > 3){
		imagePosition = -1;
	}

	if(imageBook[imagePosition+1].length <5){
		imagePosition = imagePosition +1;
		nextImage();
	}else{
		document.getElementById('imageDetails').src = 'images/_'+imageBook[imagePosition+1];
		document.getElementById('imageDetails').title = descriptionBook[imagePosition+1];
		document.getElementById('textControler').innerHTML = descriptionBook[imagePosition+1];
		imagePosition = imagePosition + 1;
	}
}

function previousImage(){
	if((imagePosition-1) < 0){
		imagePosition = 4;
	}
	if(imageBook[imagePosition-1].length < 0){
		imagePosition = imagePosition -1;
		previousImage();
	}else{
		document.getElementById('imageDetails').src = 'images/_'+imageBook[imagePosition-1];
		document.getElementById('imageDetails').title = descriptionBook[imagePosition-1];
		document.getElementById('textControler').innerHTML = descriptionBook[imagePosition-1];
		imagePosition = imagePosition - 1;
	}
}

function rolloverHomeBox(id,i,position,action){
	if(action == 'out'){
		document.getElementById(id).src = 'images/home.destaque.'+position+'.'+i+'.jpg';	
	}else{
		document.getElementById(id).src = 'images/home.seta.'+position+'.OFF.png';	
	}	
}

//function to get random number upto m
function randomXToY(minVal,maxVal,floatVal)
{
  var randVal = minVal+(Math.random()*(maxVal-minVal));
  return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);
}