if (!navigator.javaEnabled()) document.write("This browser does not have Java enabled.");
var submit_accepted = false;
var width = 525;
var height= 600;
if (navigator.platform != 'MacPPC')
{
        if (navigator.appName == "Microsoft Internet Explorer")
              {width=238;height=245;}
        else if (parseInt(navigator.appVersion) > 4)
              {width=600;height=450;}
        else
    	  {
        width=window.outerWidth;
        if (width < 800) width=800;
        height=window.outerHeight;
        if (height <600) height=600;
    	  }
} else{
        if (navigator.appName == "Microsoft Internet Explorer")
              {width=525;height=500;}
        else if (parseInt(navigator.appVersion) < 5)
              {width=850;height=600;}
        else  {width=525;height=500;}
}

function do_submit(frm)
{
	fName=frm.p_firstname.value;
	lName=frm.p_lastname.value;
	email=frm.p_email.value;
	var currentUrl=window.location.pathname;
	if(document.location.href.indexOf("?") != -1) {
		var params = document.location.href.substring(document.location.href.indexOf("?"), document.location.href.length);
		currentUrl += params;
	}
	/* if (submit_accepted) // prevents NN4 resubmission
        return(false); */
	if (fName==""||lName==""||email==""){
		var redirectUrl = currentUrl+"&initChat=true";
		window.location="/en_ca/registration/?redirect_page=" + escape(redirectUrl);
		//window.open('', "chat_window",'resizable=yes,scrollbars=no,width='+width+',height='+height);
		return false;
		
	}	
    submit_accepted = true;

   // form.submit_btn.disabled = true;

    window.open('', "chat_window",'resizable=yes,scrollbars=no,width='+width+',height='+height);

    frm.submit();

    //return(false);
}

function showChatDescContainer(isOpacity) {
	$('chatDescContainer').style.display = 'block';
	var nav = navigator.userAgent.toLowerCase();
	if (nav.indexOf('mac') != -1 && nav.indexOf('firefox') != -1) {
		isOpacity = "true"; //special case for firefox on mac
	}

	if (isOpacity == 'true') {
		$('cgChatDescImg').className = "opacity";
	}
}

function hideChatDescContainer() {
	$('chatDescContainer').style.display = 'none';
	$('cgChatDescImg').className = "opacity62";		
}		

