jQuery(document).ready(function() {

	//Select all anchor tag with rel set to tooltip
	jQuery('a[rel=wpsptooltip]').mouseover(function(e) {

			//Grab the title attribute's value and assign it to a variable
			var tip = jQuery(this).attr('name');

			//Append the tooltip template and its value
			jQuery(this).append('<div id="wpsptooltip" style="display:none"><div class="tipHeader"></div><div class="tipBody">' + tip + '</div><div class="tipFooter"></div></div>');

			//Set the X and Y axis of the tooltip
			jQuery('#wpsptooltip').css('top', e.pageY + 5 );
			jQuery('#wpsptooltip').css('left', e.pageX + 5 );

			//Show the tooltip with faceIn effect
			jQuery('#wpsptooltip').fadeTo('10',0.95);

	});

	//Select all anchor tag with rel set to tooltip
	jQuery('a[rel=wpsptooltip]').mouseout(function(e) {

			jQuery(this).children('div#wpsptooltip').remove();

	});

	jQuery('.selectall').click(function(e) {
		jQuery(this).focus();
		jQuery(this).select();
	});

    // show existing AR
    showaroptions('defaultlist_type',1);
});



function validateform()
{
    var valid = true;
    jQuery('.error').remove();


    if(!valid)
    {
        alert("Please fix the errors marked below!");
    }

    return valid;
}


function showaroptions(elem, id)
{
    jQuery('.ar_list_'+id).hide();
    var list = jQuery('#'+elem).val();
    jQuery('#ar_list_'+list+'_'+id).show();
    if(list == 'AW')
    {
        jQuery('#AR_list_AW_1_un').show();
    }
}

