
function DetectImageSize(picPath,picTitle)
{
    
  image_1 = new Image();
  image_1.src = picPath;
  var picName=image_1;
  picURL=picName.src;
  newWindow=window.open(picURL,'newWin','scrollbars=yes,toolbar=yes,width='+picName.width+',height='+picName.height);
  newWindow.document.write('<html><head><title>'+picTitle+'<\/title><\/head><body oncontextmenu="return false;" background="'+picURL+'"><\/body><\/html>');
  newWindow.resizeBy(picName.width-newWindow.document.body.clientWidth,picName.height-newWindow.document.body.clientHeight);
  newWindow.focus();
} 

function isEmail(email) {
	var pattern = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.0123456789@~";
	var theStr = new String(email)
	var index = theStr.indexOf("@");

	for (var a=0; a<pattern.length; a++) {
		if (pattern.indexOf(email.charAt(a),0) == -1) return false;
	}
	if (theStr.indexOf(" ",0) != -1) return false;
	if (index > 0) {
		var pindex = theStr.indexOf(".",index);
		if ((pindex > index+1) && (theStr.length > pindex+1)) return true;
	}
	return false;
}

function sendtofriend()
{
	var email=document.frmSmail.txt_email.value;
	if(!isEmail(email))
	{
		alert("Invalid email.");	
		document.frmSmail.focus();
		return false;
	}
	else
		document.frmSmail.submit();
		
}

function changenews(index)
{
	for(var i=0;i<5;i++)
	{
		var tmp="divnewsTabContent_"+i;
		var tab="liTab_"+i;
		if(document.getElementById(tmp)!=null)
		{
			document.getElementById(tmp).style.display='none';
			document.getElementById(tab).className='';
			
		}
	}
	var tmp1="divnewsTabContent_"+index;
	var tab1="liTab_"+index;
	document.getElementById(tmp1).style.display='';
	document.getElementById(tab1).className='current';
	
}
