/*
 * WKSA subpage JavaScript
 * SWF Object embeds and other stuff
 */

var flashvars = {};
var params = { wmode:"transparent", menu:"false" };
var attributes = {};

swfobject.embedSWF("flash/subflash.swf", "subflash_embed", "964", "240", "9.0.0","flash/expressInstall.swf", flashvars, params, attributes);

function set_geo_id(id){
    document.getElementById('geo_id').value = id;
    document.getElementById('geo_frm').submit();
}

function update_owner_pass(id){
    var pass = $F('owner_update_pass');
    var params = 'type=uop&id=' + id + '&pass=' + pass;
    var ajax = new Ajax.Updater(
        { success: 'pass_update_box' },
        'script/ajax.php?type=uop',
        { method: 'get', parameters: params, onFailure:function(req){ $('pass_update_box').html(req); } }
    );
}

function clear(id){
    $('#'+id).html("");
    $('#'+id).hide();
    return false;
}

function show_lost_password(){
    $('lost_pass_container').show();
}

function hide_lost_password(){
    $('lost_pass_container').hide();
}

function send_owner_rest(){
    var email = $F('owner_email'); // the email address to lookup
    var params = 'type=sorp&email=' + email;
    var ajax = new Ajax.Updater(
        { success: 'lost_pass_container' },
        'script/ajax.php?type=uop',
        { method: 'get', parameters: params, onFailure:function(req){ $('lost_pass_container').html(req); } }
    );
}

function checklogin(){
	var uid = $F('wksa_userid');
	var pass = $F('wksa_passwd');
	var error = 0;
	var err_msg = 'There was an error with your login attempt:\n\n';
	if(uid == ''){ error = 1; err_msg += '- Please enter your userid.\n'; }
	if(pass == ''){ error = 1; err_msg += '- Please enter your password.\n'; }
	err_msg += '\nCorrect the error(s) above and try again.';
	if(error == 1){
		alert(err_msg);
		return false;
	}else{
		return true;
	}
}

