
/**
 *	This function is intended to inform the portal gwt code if the
 *	browser at present has the popups blocked or not.
 */

arePopupsBlocked = function()
{
	var myTest = window.open("about:blank","_blank",
"directories=no,height=100,width=100,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no");
	if (!myTest)
	{
		//	Popups are blocked.
		return	"true";
	}
	else
	{
		myTest.close();
		return	"false";
	}
}

launchUrl = function(url)
{
//		var w = window.open(url,"_blank",
//			"menubar=no,toolbar=no,location=no,resizable="+resize+",scrollbars="
//			+scroll+",status=no,width="+width+",height="+height);
	window.open(url,"_blank","");
}


/**
 *	This function returns an integer as
 *	0 - good email,
 *	1 - bad email,
 *	2 - may be bad email.
 */
 
validateEmail_bkp  = function( givenEmail )
{
	var email = /^[^@]+@[^@.]+\.[^@]*\w\w$/  ;
	//var regExpEmail = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/; 
	//var regExpEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/;
	
	if (!email.test(givenEmail))
	{
		return 1;
	}
	
	/*if (!regExpEmail.test(givenEmail))
	{
		return 2;
	}*/	
	var email2 = /^[A-Za-z][\w.-]+@\w[\w.-]+\.[\w.-]*[A-Za-z][A-Za-z]$/  ;
	if (!email2.test(givenEmail))
	{
		return 2;
	}
  
	return 0;
}

/**
 *	This function returns an integer as
 *	0 - good email,
 *	1 - bad email,
 */
 
validateEmailNew  = function( givenEmail )
{
	var invalidChars = "~`!#$%^&*()\{}[]:;'<,>?";
	//alert(' givenEmail = '+givenEmail);
	 for (i=0; i<invalidChars.length; i++) {
		  badChar = invalidChars.charAt(i);

		  if (givenEmail.indexOf(badChar,0) > -1)
		  {
		  	//alert('Please enter a valid email & press go to receive invitation for Featured dimdim Meeting');
			  return 1;
		  }
	 }
	 var atPos = givenEmail.indexOf("@",1)
	 if (atPos == -1) {
		//alert('@ char missing');
		return 1;
	 }
	 if (givenEmail.indexOf("@",atPos+1) != -1) {
		//alert('there are two @');
		return 1;
	 }
	 
	 var periodPos = givenEmail.indexOf(".",atPos)
	 if (periodPos == -1) {
		 //alert('no . found');
		 return 1;
	 }
	 if (periodPos+3 > givenEmail.length)	{
		 //alert('after . there are less char');
		 return 1;
	 }
	return 0;
}

function copy(stringToCopy, divId) {
	try{
		//alert(stringToCopy);
		var flash = document.getElementById("movie");
		flash.SetVariable("a", stringToCopy);
		flash.thisMethod();
		return 1;
	}catch(err){
		//alert('inside exception....'+err);
		return 0;
	}
}

function handleClickPref()
{
	try{
		clickPref();
		}
	catch(e)
	{
		//alert(e);
	}
}

function showCopyMessage(s1)
{
	alert('inside flash bridge showCopyMessage '+s1);
	try{
		//JSInterfaceCobrowse.init();
		JSInterface.callGWT2('COPY_MOVIE_EVENT','FLASH_MESSAGE_LOG',+s1);
	}catch(e){
		alert(e);
	}
}
