window.onload=windowLoad;
function openWindow(url,title)
{
    /*var win = new Window({className: "spread", title: title, minimizable:false,maximizable:false,
        draggable:false,left:10, width:350, height:200, url: url});
    win.show(true);*/
    window.open(url,title,"scrollbars=yes,width=600,height=400");
}
function forgot_click()
{
	var email=prompt("Please enter your email","");
	if((echeck(email)))
	{
		$.ajax({
            type: "POST",
            url: "forgot_password.php",
            data:{
                'email':email
            },
            success:function(data){
                alert(data);
            }
        });
	}
	else
	{
		alert("Invalid email. Please try again");
	}
	return false;
}
function checkLogin()
{
    var email=trim(document.getElementById("email").value.toString());
    var passwd=document.getElementById("passwd").value.toString();
    if(email=="" || (!(echeck(email)))){
        messageBox("Please enter a valid email");
        return false;
    }
    else if(passwd==""){
        messageBox("Please enter your password");
        return false;
    }
    return true;
}
function nonRegister()
{
    messageBox("You must be logged in to access this feature");
}
function messageBox(message)
{
//    document.getElementById("msg").innerHTML=message;
//    $("#dialog").dialog( 'open' );
    alert(message);
}
function termsOfUse()
{
	try
	{
	    openWindow("includes/terms_div.php","terms_win");
	}
	catch (ex)
	{
		//alert(ex.message);
	}
}

function windowLoad()
{
    $("#dialog").dialog({///INSTANTIATES THE NORMAL MODAL DIALOG
        autoOpen:false,
        bgiframe: true,
        modal: true,
        buttons: {
            Ok: function() {
                $(this).dialog('close');
            }
        }
    });
    try{
        if(document.getElementById("G_MSG").value!=""){
            messageBox(document.getElementById("G_MSG").value.toString());
        }
        document.getElementById("email").focus();
        try
        {
            if(check_ie()==1)
            {
                document.getElementById("catList").attachEvent("onclick",nonRegister);
                document.getElementById("cat").attachEvent("onclick",nonRegister);
                
            }
            else
            {
                document.getElementById("catList").addEventListener("click",nonRegister,false);
                document.getElementById("cat").addEventListener("click",nonRegister,false);
            }
        }
        catch(ex)
        {
            //alert(ex.message);
        }
    }
    catch(ex)
    {
        //alert(ex.message);
    }
}

