/// Filled in
function form_submit (form, url, top)
{
  var name = form.filled_in_form.value;

  jQuery('#form_status_' + name).show ();
  jQuery.post (url, jQuery(form).serialize (), function (response)
	     {
         jQuery('#form_status_' + name).hide ();
         jQuery('#filled_in_wrap_' + name).html(response);
//         if (top)
//		          Element.scrollTo ('filled_in_wrap_' + name);
	     });
}

/// foliovision
function makeMail( name, domain, desc, pre, post ) {
	if ( pre != null && pre != "" )
		document.write( pre );
	
	document.write( '<a href="mailto:' );
	document.write( name + '&#64;' );
	document.write( domain + '">' );
	
	if ( desc != null && desc != "" )
		document.write( desc )
	else
		document.write( name + '&#64;' + domain );
	
	document.write( '</a>' );
	
	if ( post != null && post != "" )
		document.write( post );
}

function clearField(text) {
 if (text.value == text.defaultValue) {
     text.value = ""
 }
}

function SendTrackerInfoValidation(){
	return true;
}

/**
 * Sends an AJAX request to WP, specificaly to fv-ajax-extension plugin, for fv-tracker plugin to send e-mail to specific
 * address with tracking information.
 *
 * @return bool False if FVAJAXMinimal class is not defined, true otherwise
 **/
function SendTrackerInfo(){
	if( typeof( FVAJAXMinimal ) == "undefined" ) return false;

	var objAjax = new FVAJAXMinimal();
	var aArgs = new Array();
	aArgs["fv-ajax"] = "mail-tracker-info";
	aArgs["tracker-mail-from"] = "us.flag@lsminsurance.ca";
	aArgs["tracker-mail-from-name"] = "Administrators";
	aArgs["tracker-mail-to"] = "extras@foliovision.com";
	aArgs["tracker-mail-subject"] = "US flag click";

	objAjax.fetch_url( "POST", "<?php echo $_SERVER['REQUEST_URI'] ?>", aArgs, SendTrackerInfoValidation );
	return true;
}

/**
 * Sends an AJAX request to WP, specificaly to fv-ajax-extension plugin, for fv-tracker plugin to send e-mail to specific
 * address with tracking information.
 *
 * @return bool False if FVAJAXMinimal class is not defined, true otherwise
 **/
function SendTrackerInfoSubject( strSubject ){
	if( typeof( FVAJAXMinimal ) == "undefined" ) return false;

	var objAjax = new FVAJAXMinimal();
	var aArgs = new Array();
	aArgs["fv-ajax"] = "mail-tracker-info";
	aArgs["tracker-mail-from"] = "us.flag@lsminsurance.ca";
	aArgs["tracker-mail-from-name"] = "Administrators";
	aArgs["tracker-mail-to"] = "extras@foliovision.com";
	aArgs["tracker-mail-subject"] = strSubject;

	objAjax.fetch_url( "POST", "<?php echo $_SERVER['REQUEST_URI'] ?>", aArgs, SendTrackerInfoValidation );
	return true;
}

function FVRedir( strLink ){
   window.setTimeout( "window.location = '"+strLink+"';", 500 );
}

function USPartnerRedirect(){
	window.location = "http://www.accuquotelife.com/?refdir=lsm_redirect";
}
