// JavaScript Document

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function openWindow(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) {  // v4.01
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');
	}else{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">');
	}
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

var popUpWin=0;

function popUpWindow(URLStr, left, top, width, height)

{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}

var page = null;

function viewCount(pkgid,pg){
	
	var url = 'packageview.php';
	var params = 'pkgid='+pkgid+'&page='+pg;
	page = pg;
	var count = new Ajax.Request(
				
				url,
				{
					method: 'get',
					parameters: params,
					//onComplete: openPkgDet
				}
				
				)
	
}

function openPkgDet(){
	
	window.open(page, '_blank');
	
}

var result;
function checkEmail(){
	var str = document.contact.email.value;
	var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	
	if (filter.test(str)){
	
		result = true;
	
	}
	else{

		alert("Please input a valid email address!")
		result = false;

	}
	return (result)
}

function checkFirst(){

	if (document.layers||document.getElementById||document.all){

		return checkEmail();

	}
	else{

		return true;

	}
}

function isValidEmail(str) {

	if((str.indexOf(".") > 2) && (str.indexOf("@") > 0)){

		alert(str);		
		return true;

	} else {

		alert('You must provide a valid email adress!');
		return false;

	}
 
}


