﻿window.addEvent( 'domready', function(){

	var mainNavAccordion = new Accordion($$('.mainNavToggler'), $$('.mainNavElement'), {
		opacity: false,
		start:'all-closed',
		alwaysHide:true,
		onActive: function(toggler, element) {
		element.setStyle('display','block');
		toggler.getParent().addClass(' activeClicked');
		},
		onBackground: function(toggler, element) {
		toggler.getParent().removeClass('activeClicked');
		}
	});
	
	
	var dropdowns = $$('.mainNavElement');
	dropdowns.each(function(element){
		var fx = new Fx.Style(element, 'height', {duration:500, wait:false});
		element.addEvent('mouseleave', function() {								
			fx.start(0);
			$$('.mainNavToggler').getParent().removeClass('activeClicked');
			
		});
	});

});

 
$(function() {

    $('.fontSize').click(function() {

        //set the cookie
        function setCookie(name, value, expires) {
            document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString());
        }
        var exp = new Date();     //set new date object 
        exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30));     //set it 30 days ahead


        //set fontSize var based on whether it's a category or product detail page.
        var fontSize = $('.productCopy');
        if (fontSize.length == 0) {
            fontSize = $('.categoryCopy');
        }





        //font vars
        var currFontSize = fontSize.css('fontSize');
        var finalNum = parseFloat(currFontSize);
        //var fontEnding = currFontSize.slice(-2);
        //line height vars
        var currLineHeight = fontSize.css('lineHeight');
        var finalHeight = parseFloat(currLineHeight);
        //var lineheightEnding = currLineHeight.slice(-2);




        //if the id of the .fontSize class button is bigRun, increase the sizes of the final vars and set cookies.
        if (this.id == 'bigRun') {
            //alert(currFontSize);
            //if (currFontSize < '20px') {
            //$('#bigRun').removeClass('disabled');
            //$('#smallRun').removeClass('disabled');
            finalNum = '16px';
            finalHeight = '22px';
            setCookie('fontSize', finalNum, exp);
            setCookie('lineHeight', finalHeight, exp);
            $('#bigRun').addClass('active');
            $('#smallRun').removeClass('active');


            //}
            //else { $('#bigRun').addClass('disabled'); }

        }
        else if (this.id == 'smallRun') {

            //if (currFontSize > '12px') {
            //$('#smallRun').removeClass('disabled');
            //$('#bigRun').removeClass('disabled');
            finalNum = '12px';
            finalHeight = '18px';
            setCookie('fontSize', finalNum, exp);
            setCookie('lineHeight', finalHeight, exp);
            $('#bigRun').removeClass('active');
            $('#smallRun').addClass('active');
            //}
            //else { $('#smallRun').addClass('disabled'); }
        }

        //run the animation
        fontSize.animate({ fontSize: finalNum, lineHeight: finalHeight }, 600);
    });
});
//get cookie
function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

//set vars based on cookies
var fontSizeCookie = (getCookie("fontSize"));
var lineHeightCookie = (getCookie("lineHeight"));


$(function() {

    var fontSize = $('.productCopy');
    if (fontSize.length == 0) {
        fontSize = $('.categoryCopy');
    }


    //set copy size to sizes of cookie variables.
    fontSize.css('fontSize', fontSizeCookie);
    fontSize.css('lineHeight', lineHeightCookie);

    if (fontSizeCookie == '12px') {

        $('#bigRun').removeClass('active');
        $('#smallRun').addClass('active');

    }
    else if (fontSizeCookie == '16px') {

        $('#bigRun').addClass('active');
        $('#smallRun').removeClass('active');

    }




});

function flipTable(tblName) {
    if (document.getElementById(tblName).style.display == 'none')
        document.getElementById(tblName).style.display = ''
    else
        document.getElementById(tblName).style.display = 'none'
}

function flipDiv(divToFlip,visible){
	
	 
	if(visible != "undefined"){
		if(visible === true){
			divToFlip.style.display = 'block';
		}
		else if(visible === false){
			divToFlip.style.display = 'none';
		}
	}
	else{
		if(divToFlip.style.display == 'none')
		{
			divToFlip.style.display = 'block';
		}
		else
		{
			divToFlip.style.display = 'none';
		}
	}
};


function openlinks_newWindow(targeturl)
{

	if(targeturl.indexOf('http:') > -1){
		
		if(targeturl.indexOf(window.location.host) > -1  || targeturl.indexOf('calcxml') > -1){
			trackExternalLinks(targeturl);
			window.open(targeturl);
		}
		else{
			var agree=confirm("You are now leaving the Farm Bureau Financial Services Web site. To proceed, please click \"OK\" below. Or, click \"Cancel\" to return to the Farm Bureau Financial Services Web site.");
			if (agree)
			{
				trackExternalLinks(targeturl);
				window.open(targeturl);
			}else
			{
				//window.close();
			}
		}
	}
	else{
		trackExternalLinks(targeturl);
		window.open(targeturl);
	}
}

function openlinks_location(targeturl)
{
		
	if(targeturl.indexOf('http:')>-1){
		
		if(targeturl.indexOf(window.location.host) > -1  || targeturl.indexOf('calcxml') > -1){
			trackExternalLinks(targeturl);
			window.location.href=targeturl;
		}
		else{
			var agree=confirm("You are now leaving the Farm Bureau Financial Services Web site. To proceed, please click \"OK\" below. Or, click \"Cancel\" to return to the Farm Bureau Financial Services Web site.");
			if (agree)
			{
				trackExternalLinks(targeturl);
				window.location.href=targeturl;
			}
		}
	}
	else{
		trackExternalLinks(targeturl);
		window.location.href=targeturl;
	}
}

function trackExternalLinks(name)
{
	pageTracker._trackEvent("Link", "Click", name);
}

function openRelatedLinks(targeturl, n_wind)
{
	if(n_wind=="0"){
		openlinks_location(targeturl);
	}
	else{
		openlinks_newWindow(targeturl);
	}
}


String.prototype.trim = function()
	{
     return this.replace(/^\s+|\s+$/g,"");
	}
/*
Encapsulate web service (.NET) call using Mootools ajax library mootools-1.2.1-core.js
    
Usage example:
        
var ws = new WebService();
ws.setArguments(new Hash({ 'agentName': 'daniel','location':'somewhere'}));
ws.setMethod("GetOfficesByLocationAndAgentName");
ws.setUrl("http://localhost:53031/AgentLocatorService.asmx");
ws.setNamespace("http://fbfs.ebusiness.agentlocator.com/");
ws.setCallback(function(result) {
if (result.success) {
alert(result.data.First + " " + result.data.Last);
}
else {
alert("error");
}
});

ws.Invoke();
*/
function WebServiceCall() {

    var _url;
    var _ns;
    var _method;
    var _data;
    var _headers;
    var _callback = null;
    var _argsDic;
    var _result = new Object();
    var _isDebugMode = true;
    var _resultName = "data";

    //Get or set web service url
    this.setUrl = function(newUrl) { _url = newUrl; };
    this.getUrl = function() { return _url; };

    //Get or set web service namespace
    this.setNamespace = function(namesspace) { _ns = namesspace; };
    this.getNamespace = function() { return _ns; };

    //Get or set method name to call
    this.setMethodName = function(newMethod) { _method = newMethod; };
    this.getMethodName = function() { return _method; };

    //Set callback method
    this.setCallback = function(clbck) { _callback = clbck; };

    //Get or set calling method arguments
    this.setArguments = function(argsHash) { _argsDic = argsHash; };
    this.getArguments = function() { return _argsDic; };

    //Get or set debug mode
    this.setDebugMode = function(debug) { _isDebugMode = debug; };
    this.getDebugMode = function() { return _isDebugMode; };
    
    //Get of set result name
    this.setResultName = function(resultName) { _resultName = resultName };
    this.getResultName = function() { return _resultName; };
    
    //Invoke web service
    this.Invoke = function() {
        if (_isDebugMode) {
            debug("INVOKE:\n\nurl: " + _url + "\nmethod: " + _method + "\nnamespace: " + _ns);
        }

		var syncXhr = new XHR({
							  async: true, 
							  method: 'post',
							  onSuccess :function(responseXml){
								        if (_isDebugMode) {
                    debug("RESPONSE:\n\n" + responseXml);
                }
                if (!responseXml || responseXml === '@ERROR@') {
                    if (_isDebugMode) {
                        debug("Invalid response from server!");
                    }
                    handleCallback(false, "Invalid response from server!");
                    return;
                }

                var xmlObj = null;
                if (-1 != window.navigator.appName.indexOf("Internet Explorer")) {
                    xmlObj = new ActiveXObject("Microsoft.XMLDOM");
                    xmlObj.async = "false";
                    xmlObj.loadXML(responseXml.toString());
                } else {
                    xmlObj = new XMLHttpRequest();
                    xmlObj.async = "false";
                    var parser = new DOMParser();
                    xmlObj = parser.parseFromString(responseXml, "text/xml");
                }

                if (xmlObj.documentElement != null) {
					
                    var xmlResult = xmlObj.documentElement.getElementsByTagName(_method + 'Result');
                    
					var nut="";
					for(var i=0;i<xmlResult[0].childNodes.length;i++){
					 nut+= xmlResult[0].childNodes[i].nodeValue;
					}
					nut = nut.replace(/[\n\r\t]/g, '');
					
					try{
                    	var json = eval('(' + nut + ')');
						handleCallback(true, json);
					}catch(e){
						handleCallback(false,"@NO_RESULT@");	
					}	
                }

							  },
							  onFailure : function(instance){
								 handleCallback(false, instance);
							  },
							 
							  urlEncoded:false,
							  headers:{
								  		'Content-Type': 'text/xml; charset="utf-8"'
							  		  }
							  });
	 
	 
		 
	  
	 
		
		syncXhr.send(_url, GetSoapEnvelope(_method, _ns, _argsDic));

	 
   
		
    };

    //Invoke callback function
    var handleCallback = function(success, data) {
        if (_callback) {
            _result.success = success;
            _result[_resultName] = data;
            _callback(_result);
        };
    };

    //Redirect all debug messages here to be handled
    var debug = function(msg) {
            alert(msg);
    };

    //Create SOAP envelope
    var GetSoapEnvelope = function(WebMethod, Namespace, paramHash) {
        var envelope = '';
        envelope += '<?xml version="1.0" encoding="utf-8"?>\n';
        envelope += '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">\n';
        envelope += ' <soap:Body>\n';
        if (paramHash.keys().length > 0) {
            envelope += ' <' + WebMethod + ' xmlns="' + Namespace + '">\n';
            paramHash.each(function(value, key) {
                envelope += '   <' + key + '>' + value + '</' + key + '>\n';
            });
            envelope += ' </' + WebMethod + '>\n';
        } else {
            envelope += ' <' + WebMethod + ' xmlns="' + Namespace + '" />\n';
        }
        envelope += ' </soap:Body>\n';
        envelope += '</soap:Envelope>';

        if (_isDebugMode) {
            debug("SOAP ENVELOPE: \n\n" + envelope);
        }

        return envelope;
    };

};
// JavaScript Document

/**************************************************************

	Script		: Overlay
	Version		: 1.2
	Authors		: Samuel birch
	Desc		: Covers the window with a semi-transparent layer.
	Licence		: Open Source MIT Licence

**************************************************************/

var Overlay = new Class({
	
	getOptions: function(){
		return {
			colour: '#000',
			opacity: 0.6,
			zIndex: 9998,
			container: document.body,
			onClick: Class.empty
		};
	},

	initialize: function(options){
		this.setOptions(this.getOptions(), options);
		
		this.options.container = $(this.options.container);
		
		this.container = new Element('div').setProperty('id', 'OverlayContainer').setStyles({
			position: 'absolute',
			left: '0px',
			top: '0px',
			width: '150%',
			zIndex: this.options.zIndex
		}).injectInside(this.options.container);
		
		this.iframe = new Element('iframe').setProperties({
			'id': 'OverlayIframe',
			'name': 'OverlayIframe',
			'src': 'javascript:void(0);',
			'frameborder': 1,
			'scrolling': 'no'
		}).setStyles({
			'position': 'absolute',
			'top': 0,
			'left': 0,
			'width': '150%',
			'height': '100%',
			'filter': 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)',
			'opacity': 0,
			'zIndex': 9999
		}).injectInside(this.container);
		
		this.overlay = new Element('div').setProperty('id', 'Overlay').setStyles({
			position: 'absolute',
			left: '0px',
			top: '0px',
			width: '100%',
			height: '100%',
			zIndex: 9999,
			backgroundColor: this.options.colour
		}).injectInside(this.container);
		
		this.container.addEvent('click', function(){
			this.options.onClick();
		}.bind(this));
		
		this.fade = new Fx.Style(this.container, 'opacity').set(0);
		this.position();
		
		window.addEvent('resize', this.position.bind(this));
	},
	
	position: function(){ 
		if(this.options.container == document.body){ 
			var h = window.getScrollHeight()+'px'; 
			this.container.setStyles({top: '0px', height: h}); 
		}else{ 
			var myCoords = this.options.container.getCoordinates(); 
			this.container.setStyles({
				top: myCoords.top+'px', 
				height: myCoords.height+'px', 
				left: myCoords.left+'px', 
				width: myCoords.width+'px'
			}); 
		} 
	},
	
	show: function(){
		this.fade.start(0,this.options.opacity);
	},
	
	hide: function(){
		this.fade.start(this.options.opacity,0);
	}
	
});
Overlay.implement(new Options);

/*************************************************************/


    //<reference path="mootools.js">
    //<reference path="overlay.js">

    function getViewport(){
		
		var  width;
 		var  height;
 
	 	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
		 if (typeof window.innerWidth != 'undefined')
		 {
			  width = window.innerWidth,
			  height = window.innerHeight
		 }
		 
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
		 else if (typeof document.documentElement != 'undefined'
			 && typeof document.documentElement.clientWidth !=
			 'undefined' && document.documentElement.clientWidth != 0)
		 {
			   width = document.documentElement.clientWidth,
			   height = document.documentElement.clientHeight
		 }
		 
		 // older versions of IE
		 else
		 {
			   width = document.getElementsByTagName('body')[0].clientWidth,
			   height = document.getElementsByTagName('body')[0].clientHeight
		 }
		 
		 
		 var viewport = new Object();
		 viewport.width = width;
		 viewport.height = height;
		 
		 return viewport;
	};

	function translateEvent(e){
		var ev= (window.event)? window.event: e;
		if(!ev || !ev.type) return false;
		var ME= ev;
		
		if(ME.type.indexOf('key')!= -1){
			if(ME.type.indexOf('keypress')!= -1){
				ME.key= (ev.keyCode)? ev.keyCode: ((ev.charCode)? ev.charCode: ev.which);
			}
			else ME.key= ev.charCode;
			if(ME.key) ME.letter= String.fromCharCode(ME.key);
		}
		return ME;
	};


	function getStyleObject(objectId) {
	 
		if(document.getElementById && document.getElementById(objectId)) {
		// W3C DOM
		return document.getElementById(objectId).style;
		} else if (document.all && document.all(objectId)) {
		// MSIE 4 DOM
		return document.all(objectId).style;
		} else if (document.layers && document.layers[objectId]) {
		// NN 4 DOM.. note: this won't find nested layers
		return document.layers[objectId];
		} else {
			return false;
		}
	}; // getStyleObject


	String.prototype.trim = function()
	{
		return this.replace(/^\s+|\s+$/g,"");
	};

	function isValidZipCode(value) 
	{
   		var re = /^\d{5}([\-]\d{4})?$/;
   		return (re.test(value));
	};
	
	function PopUp()
	{  
		this.content = "";
		this.content2=null;
		this.innerDom = "";
		this.Height = "150px";
		this.Width = "300px";
		this.XboxClass = 'SimpleInputBoxClose';
		this.forceResize= function(){
			var winW = ""; var winH = "";
			
			var st = getStyleObject("simpleDlg");
			var viewport = getViewport();

			winW = viewport.width;
			winH = viewport.height;

				
			 if (document.layers)
			 {
				st.left=winW/2 - (this.Height.replace(/px/,"")/2 + 30);
				st.top= winH/2 - (this.Width.replace(/px/,"")/2 + 100);
			 }
			 else 
			 {
				st.left=winW/2 - (this.Height.replace(/px/,"")/2 + 30)+"px";
				st.top= winH/2 - (this.Width.replace(/px/,"")/2 + 100)+"px";
			 }
		}
	};
	
	PopUp.OK = "OK";
	PopUp.CANCEL = "CANCEL";
	
	PopUp.prototype.show = function(callback, w,h)
	{
		if(w && h){
			this.Height = h;
			this.Width = w;
		}
		var clb = callback;
	    
	    var a = new Overlay();
        a.show();
		
		this.innerDom = new Element('div').setProperty('id', 'innerDom');
	 
	 	var o = new Element('div').setProperty('id', 'simpleDlg').setStyles({
			position: 'absolute',
			left:window.screen.width/2 - (this.Width.replace(/px/,"")/2+ 30),
			top: window.screen.height/2 - (this.Height.replace(/px/,"")/2 + 100),
			width: this.Width,
			height:this.Height,
			zIndex: 9999,
			backgroundColor: '#FFF'
		});	
		
		if(this.content2 == null)
			o.innerHTML = this.content;
		 else
			o.appendChild(this.content2);
			
		var WW = this.Height;
		var HH = this.Width;
		var XClass = this.XboxClass;
		var resize = function(){
			var winW = ""; var winH = "";
			
			var st = getStyleObject("simpleDlg");
			var viewport = getViewport();

			winW = viewport.width;
			winH = viewport.height;

				
			 if (document.layers)
			 {
				st.left=winW/2 - (HH.replace(/px/,"")/2 + 30);
				st.top= winH/2 - (WW.replace(/px/,"")/2 + 100);
			 }
			 else 
			 {
				st.left=winW/2 - (HH.replace(/px/,"")/2 + 30)+"px";
				st.top= winH/2 - (WW.replace(/px/,"")/2 + 100)+"px";
			 }
		};

		window.onresize = resize;
		
		var f = function(){
			
			o.injectInside(document.body);
			SetFocusToFirstPossibleInput();
			this.closeButton = new Element('div').addClass(XClass).injectInside(o);
			this.closeButton.onclick = function(){CloseBox();};
			
			this.okButton = o.getElementById('_ok_');
			if(this.okButton){
				this.okButton.onclick = function(){preCallbackHook(o.getElementById('_zip_').value)};
				
			}
		
			window.scrollTo(0,0);
			resize();
		};
		  
		setTimeout(f,600);
			
		function SetFocusToFirstPossibleInput(){
			var firstInput = o.getElementsByTagName('input');
			if(firstInput){
				for(var i = 0;i<firstInput.length;i++){
					var type = firstInput[i].getAttribute("type");
					if(type == "text" || type == "button"){
						firstInput[i].focus();
						break;
					}
				}
			}
		};
		
		function preCallbackHook(msg)
	 	{
			if(clb){
			    var r = clb(msg);
				if(r)
					setTimeout(CloseBox,3000);
			}
		  	else{
				
				 setTimeout(CloseBox,3000);
			}
	 	};

        var CloseBox = function()
        {
        	a.hide()
	       	o.empty();
	       	o.remove();
			showSelects();
			document.body.onresize = null;
			if(window.ie6  === true) {
			$('selectBox').style.display = 'block';
			}
			 
        };
		
		this.close = function(){
			CloseBox();	
			
		};
	 	
	 	function hideSelects()
        {
	        var oSelects=document.getElementsByTagName("select");
	        for(var i=0;i<oSelects.length;i++)
	        oSelects[i].className+="hide";
        };



        function showSelects()
        {
	        var oSelects=document.getElementsByTagName("select");
	        for(var i=0;i<oSelects.length;i++)
	        oSelects[i].className=oSelects[i].className.replace("hide","");
        };

	};
	
	var PleaseWait2 = new Class({
		 
		initialize:function(txt){
			var outter = new Element('div');
			var span = new Element('div');
			span.setStyle('float','left');
			span.inject(outter);
			var div = new Element("div");
			div.setStyle('float','left');
			div.setProperty("id","dyn");
			div.inject(outter);
			var d = ["",".","..","..."];
			var i = 0;
			(function(){
				if(div && div.setText){
					div.setText(txt + " " + d[i]);
					i++;
					if(i > d.length -1)
					i = 0;
				}
			}).periodical(500);
			
			return outter;
		}
		
		
	});
	
	UserMessage.prototype =  new PopUp();
	UserMessage.prototype.constructor = UserMessage;  
	 
	function UserMessage(){this.XboxClass = 'SimpleInputBoxClose3'; this.Height = "50px";};

	UserMessage.prototype.show = function(clb)
	{
		 var div = new Element('div');
		 div.setStyle('height','50px');
		 div.addClass('boxContainer');
		 div2 = new Element('div');
		 div2.addClass("box");
		 div2.inject(div);
		 var pw = new PleaseWait2("Please wait while we retrieve your policy information");
		 pw.setStyle('padding','10px');
		 pw.inject(div2);
		 this.content2 = div; 
		 
		 PopUp.prototype.show.call(this,clb); 
	};
	
	
	
	
	CantSeePolicyHelp.prototype =  new PopUp();
	CantSeePolicyHelp.prototype.constructor = CantSeePolicyHelp;
	
	function CantSeePolicyHelp(){if(window.ie6  === true) {$('selectBox').style.display = 'none';}};

	CantSeePolicyHelp.prototype.show = function(agentid,clb)
	{
		 var div = new Element('div');
		 div.addClass('boxContainer');
		 div2 = new Element('div');
		 div2.addClass("box");
		 div2.inject(div);
		 var pw = new Element('div');
		 pw.setText("You must be listed as the policy owner to view the policy detail. If you are listed on the policy, but not the owner, you may still make an online payment.");
		 
		 var t1 = new Element("div");
		 t1.setText("If you have any questions, please ");
		 t1.setStyle('padding-top','10px');
		 
		 pw.setStyle('padding','5px');
		 
		 pw.inject(div2);
		 
		 var lnk = new Element("a");
		 lnk.setAttribute("href", "/Pages/AgentOfficeLocator/AgentInformation.aspx?AgentId=" + agentid);
		 lnk.setText("contact your agent");
		 pw.adopt(t1);
		 pw.adopt(lnk);
		 
		 var t2 = new Element("div");
		 
		 t2.setText("or call a customer service representative Monday - Friday 8:00 a.m. - 4:30 p.m. Central Time at (800) 814-5570.");
		 pw.adopt(t2);
		 
		 this.content2 = div; 
		 
		 PopUp.prototype.show.call(this,clb); 
	};
	
	
	ProofOfInsuranceMessageBox.prototype =  new PopUp();
	ProofOfInsuranceMessageBox.prototype.constructor = ProofOfInsuranceMessageBox;
	
	function ProofOfInsuranceMessageBox(email,onOk){
		this.email = email
		this.onOk = onOk;
	    this.XboxClass = 'SimpleInputBoxClose2';
		if(window.ie6  === true) {
		$('selectBox').style.display = 'none';
		}
	};
	
	ProofOfInsuranceMessageBox.prototype.show = function(agentid,clb)
	{
		 var div = new Element('div');
		 div.setStyle('height','160px');
		 div.addClass('boxContainer');
		 div2 = new Element('div');
		 div2.addClass("box");
		 div2.inject(div);
		 var pw = new Element('p');
		 
		 pw.setText("You are requesting a copy of proof of insurance for your vehicle. If you would like us to " + 
									   "process this request please hit \"OK.\" If not, please hit \"Cancel.\" If you choose to " +
									   "continue, within 24 hours, you will receive your proof of insurance via e-mail at the address " +
									   "listed in your profile, " + this.email);
		 pw.setStyle('padding','4px');
		 
		 pw.inject(div2);
		 
		 var ok = new Element("input");
		 ok.setAttribute("type","button");
		 ok.setAttribute("value","  OK  ");
		 ok.setStyle('margin-right','5px');
		 
		 var cancel = new Element("input");
		 cancel.setAttribute("type","button");
		 cancel.setAttribute("value","Cancel");
		 cancel.setStyle('margin-right','5px');
		 
		 var btnDiv = new Element("div");
		 btnDiv.setStyle("float","right");
		 btnDiv.setStyle("padding-top","15px");
		 ok.inject(btnDiv);
		 cancel.inject(btnDiv);
		
		 ok.addEvent('click',this.onOk);
		 cancel.addEvent('click',function(){this.close()}.bind(this));
		  btnDiv.inject(pw);
		
		 
		 this.content2 = div; 
		 
		 PopUp.prototype.show.call(this,clb); 
	};
	
	

	SimpleInputBox.prototype =  new PopUp();
	SimpleInputBox.prototype.constructor = SimpleInputBox;
	
	function SimpleInputBox(){};
	 
	SimpleInputBox.prototype.show = function(clb)
	{
		this.content = "<div class='boxContainer'><div class='box'><div style='padding:10px;'>You can count on Farm Bureau Financial Services to help you make important decisions about your future.  We provide a variety of products and services throughout a 15-state area.  Please enter your ZIP code below to learn what's available in your area.</div><div id='searchform3'><strong>Enter your ZIP Code:&nbsp;</strong><input type='text' id='_zip_' name='_zip_' onkeypress ='if(event.keyCode==13)okButton.onclick()'/><a style='cursor:pointer;' target='_parent' class='button3' id='_ok_' name='_ok_'></a></div></div></div>";;
		
		PopUp.prototype.show.call(this,clb); 

	};
	
	
	
	
	
	
	OnlineClaimMessage.prototype =  new PopUp();
	OnlineClaimMessage.prototype.constructor = OnlineClaimMessage;
	function OnlineClaimMessage(){};
	OnlineClaimMessage.prototype.setContent= function(cnt){
	 	this.content=document.getElementById(cnt).innerHTML;
	};
	OnlineClaimMessage.prototype.show = function(clb){
		PopUp.prototype.show.call(this,clb); 
	};
	
	OnlineClaimMessage.prototype.toggle = function(c){
		alert(c);
		//alert(document.getElementById("simpleDlg").innerHTML); 
		//flipDiv(document.getElementById(c));
	};
	
	
	PleaseWait.prototype =  new PopUp();
	PleaseWait.prototype.constructor = UserMessage;
	
	function PleaseWait(){};

	PleaseWait.prototype.show = function(clb)
	{
		 this.content =  "<div class='boxContainer'><div class='box'><div style='padding:10px;'>Please wait...</div>";
		 
		 PopUp.prototype.show.call(this,clb); 
	};
	
	
	ThankYouForEmail.prototype =  new PopUp();
	ThankYouForEmail.prototype.constructor = ThankYouForEmail;
	
	function ThankYouForEmail(){ this.XboxClass = 'SimpleInputBoxClose1';};

	ThankYouForEmail.prototype.show = function(clb)
	{
		 this.content =  "<div class=\"box\" style=\"background-color:#e2dbc8; border:solid 10px #ffffff; height:195px;" + "background-image:url(/Resources/Images/emailthankyou.jpg); background-repeat:no-repeat; background-position:right; height:195px; width:400px;\">" +
"<div style=\"padding:10px; margin-right:200px; line-height:15px;\">Thank you for completing the e-mail registration form. " + 
"We look forward to providing you with valuable information to meet your financial goals." +
"<div id='searchform4' style='padding-top:20px;'><a style='cursor:pointer;' target='_parent' class='buttonx' id='_ok_' name='_ok_'></a></div></div></div></div>";
		
		 PopUp.prototype.show.call(this,clb); 
	};






var _ajaxConfig = { '_cfscriptLocation': '/epay/CFC/enterEpay.cfc',
    '_jsscriptFolder': '/Resources/Javascript',
    'debug': false
};



function toggle_visibility(prices) {
    var cur = document.getElementById(prices);
    var current = document.getElementById('currShowing');
    if (current.value != "none") {
        document.getElementById(current.value).style.display = "none";
    }

    if (current.value == prices) {
        cur.style.display = "none";
        current.value = 'none';
    }
    else {
        cur.style.display = 'block';
        current.value = prices;
    }

}



function equitrustPopUp(url) {
    newwindow = window.open(url, 'name', 'height=330,width=320');
    if (window.focus) { newwindow.focus() }
}



function careersPopUp(url) {
    newwindow = window.open(url, 'name', 'height=800,width=900,menubar=yes,toolbar=yes,location=yes,resizable=yes,scrollbars=yes');
    if (window.focus) { newwindow.focus() }
}



function otherOnLoad() {
    if ((document.body.scrollTop > 118)) {
        document.getElementById('blurb').style.pixelTop = document.body.scrollTop;
    }
    else {
        document.getElementById('blurb').style.pixelTop = 118;
    }
    timer = setTimeout("otherOnLoad()", 1);
}

function otherUnLoad() {
    clearTimeout(timer)
}



function openSiteHelp(url) {
    var w = 866;
    var h = 653;
    var l = screen.width / 2 - w / 2;
    var t = screen.height / 2 - h / 2;
    window.open(url + "flvplayer.html", "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes,width=" + w + ", height=" + h + ",top=" + t + ",left=" + l + "");
}




function openEmailRegForm() {
    var w = 910;
    var h = 605;
    var l = screen.width / 2 - w / 2;
    var t = screen.height / 2 - h / 2;
    window.open("/Pages/MyAccount/EmailRegistration.aspx", "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes,width=" + w + ", height=" + h + ",top=" + t + ",left=" + l + "");
}



// show or hide font resize buttons
$(document).ready(function() {
    var categoryCopy = $('.categoryCopy');
    var productCopy = $('.productCopy');

    var styleswitcher = $('#styleswitcher');
    if (styleswitcher) {
        if (categoryCopy.length == 0 && productCopy.length == 0) {

            styleswitcher.css("display", "none");
        }
        else {
            styleswitcher.css("display", "block");
        }
    }
});


/* This script block contains the script
for displaying the "Please wait while
we retrieve your policy information..."
dialog box when the user clicks on the
"Make a Payment" link/button. */


function showEpayDialog() {
    radopen(null, "PleaseWait");
    PageMethods.RefreshEpaymentOptions(loadEpay, loadEpay);
}

function loadEpay() {
    window.location = "/Pages/Payments/Payments.aspx";
}
    
    
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();