﻿/* Fadding Functions */
function fadeIn(idObjToFadeIn)
{
    var objToFadeIn = null;
        
    if(document.all)
        objToFadeIn = document.all[idObjToFadeIn];
    else
        objToFadeIn = document.getElementById(idObjToFadeIn);
    
    if(objToFadeIn==null)
        return;
    
    objToFadeIn.style.opacity = 0;  
    objToFadeIn.style.visibility = "visible";   
              
    setTimeout("animateFadeIn(document.getElementById('"+objToFadeIn.id+"'));",40);
}

function showAge(){
	$('jointParty').slideDown();
}

function hideAge(){
	
	$('jointParty').slideUp();
	document.getElementById('jointPartyAge').value='';
}

function handleJointAgeBlur()
{
    var ageElem = document.getElementById('jointPartyAge').value;
    var ageErrorElem = document.getElementById('jointAgeError');
	var ageManError = document.getElementById('jointAgeManError');

    if(ageElem == "")
	{
		ageManError.style.display = "block";
	}
	else if(!(IsNumeric(ageElem))) 
	{
		ageErrorElem.style.display = "block";
	}
	else if(ageElem < 18)
	{
		ageErrorElem.style.display = "block";
	}
	else
	{
		ageErrorElem.style.display = "none";
		ageManError.style.display = "none";
	}
}

function animateFadeIn(objToFadeIn)
{
    if(objToFadeIn==null)
        return;
        
    if(document.all)
    {
        setOpacity(objToFadeIn,1);        
        return;
    }       
              
    var opacity = getOpacity(objToFadeIn);
         
    if(opacity>=1)
        return;
   
    if(opacity==0)
        setOpacity(objToFadeIn,0.25);
    else if(opacity==0.25)  
        setOpacity(objToFadeIn,0.5);
    else if(opacity==0.5)  
        setOpacity(objToFadeIn,0.75);
    else 
    {
        setOpacity(objToFadeIn,1);
        return;
    }  
    
    opacity = getOpacity(objToFadeIn);
           
    if(opacity<1)    
        setTimeout("animateFadeIn(document.getElementById('"+objToFadeIn.id+"'));",40);
}
function setOpacity(obj,val)
{
    if(document.all)
        obj.style.filter = "alpha(opacity="+parseInt(val*100)+")";
    else
        obj.style.opacity = val;
}
function getOpacity(obj)
{
    if(document.all)
    {
       return parseFloat(obj.style.filter.substring(obj.style.filter.indexOf("=")+1,obj.style.filter.indexOf(")")))/100;
    }
    else
       return parseFloat(obj.style.opacity);
}
function fadeOut(idObjToFadeOut)
{
    var objToFadeOut = null;
        
    if(document.all)
        objToFadeOut = document.all[idObjToFadeOut];
    else
        objToFadeOut = document.getElementById(idObjToFadeOut);
    
    if(objToFadeOut==null)
        return;
    
    setOpacity(objToFadeOut,1);
    objToFadeOut.style.visibility = "visible";    
              
    setTimeout("animateFadeOut(document.getElementById('"+objToFadeOut.id+"'));",30);
}
function animateFadeOut(objToFadeOut)
{
    if(objToFadeOut==null)
        return;
             
    var opacity = getOpacity(objToFadeOut);
    
    if(opacity<=0)
        return;
       
    if(opacity==1)
        setOpacity(objToFadeOut,0.6);   
    else if(opacity==0.6)  
       setOpacity(objToFadeOut,0.3);   
    else 
    {
        objToFadeOut.style.visibility = "hidden";
        setOpacity(objToFadeOut,0);
        return;  
    }
   opacity = getOpacity(objToFadeOut);
    if(opacity>0)    
        setTimeout("animateFadeOut(document.getElementById('"+objToFadeOut.id+"'));",30);
    
}


/* Slider Functions */ 


var dragObject  = null;
var mouseOffset = null;
var pressed = false;
var overHandle = false;
var minX = 0;
var maxX = 0;
    
document.onmouseup = handleReleasedEv;
document.onmousemove = handleDocMouseMove;

function enableSlider(idSliderPanel, idSliderHandle,texts,values,enabledSteps,selFunction, defaultStep, isValue)
{
    var SliderHandle = null;
    if(document.all)
        SliderHandle = document.all[idSliderHandle];
    else
        SliderHandle = document.getElementById(idSliderHandle);
        
    var numSteps = texts.length;
    SliderHandle.parentNode.onmousemove = handleMoveEv;
    SliderHandle.onmousemove = overHandleEv;    
    SliderHandle.onmouseup = handleReleasedEv;
    SliderHandle.onmousedown = handlePressedEv;            
    SliderHandle.step = 0;
    SliderHandle.prevStep = 0;
    
    SliderHandle.parentNode.selFunction = selFunction;
    SliderHandle.parentNode.handle = SliderHandle;
    SliderHandle.parentNode.numSteps = numSteps;
    SliderHandle.parentNode.onclick = sliderClickedEv;
    SliderHandle.parentNode.onmouseout = offHandleEv;
    SliderHandle.parentNode.enabledSteps = enabledSteps;   
    SliderHandle.parentNode.values = values;
    
    SliderHandle.parentNode.selectValue = function(value)
    {
       for(var i=0;i<this.values.length;i++)
       {
            if(this.values[i]==value)
            {
                moveToStep(this.handle,i);
                break;
            }
       }
    };
     
    var barWidth = SliderHandle.parentNode.clientWidth;
    var stepSize = barWidth / (numSteps-1);
    var handleHalfWidth = SliderHandle.clientWidth/2;
    minX = 0;
    maxX = (barWidth-SliderHandle.clientWidth);
    
    var currStep = 0;
    var elemAux;
    
    for(var i=0;i < texts.length;i++)
    {
        elemAux = document.createElement("div");
        if(enabledSteps[i]==true)
            elemAux.innerHTML = "<a tabindex=\""+currStep+"\" onclick=\"moveToStep(this.parentNode.handle,"+currStep+")\">"+texts[i]+"</a>";
        else
            elemAux.innerHTML = "<span>"+texts[i]+"</span>";
        elemAux.style.position = "absolute";
        elemAux.style.bottom = "0px";
        elemAux.handle = SliderHandle;
        SliderHandle.parentNode.appendChild(elemAux);
         
        if(currStep ==0)
        {
            elemAux.style.left = "4px";
            elemAux.style.textAlign = "left";
        }
        else if(currStep == (numSteps-1))
        {
            elemAux.style.right="4px";
            elemAux.style.textAlign = "right";
        }
        else
        {
            elemAux.style.left= ((currStep*stepSize)-elemAux.clientWidth/2)+"px";
            elemAux.style.textAlign = "center";
        }
                
        currStep++;
    }
    
    
    if(isValue==true)
    {
        for(var i=0; i<values.length;i++)
        {
            if(defaultStep == values[i])
            {
                SliderHandle.step = i;
                found = true;
                break;
            }
        }
    }
    else
    {        
        if(enabledSteps[defaultStep]==false)
        {
            SliderHandle.step = 0;
            while(enabledSteps[SliderHandle.step]==false)
            {
                SliderHandle.step++;            
            }
        }
        else
        {
            SliderHandle.step = defaultStep;
        }
    }
    
    SliderHandle.prevStep = -1;
    fixHorizontalPos(SliderHandle);
    SliderHandle.prevStep = SliderHandle.step;   
}
function overHandleEv(ev)
{   
    var target;
    if(document.all)
        target = event.srcElement;
    else
        target = ev.target;
        
    overHandle = true;
    handleMoveEv(ev);
}
function offHandleEv(ev)
{
    var target;
    if(document.all)
        target = event.srcElement;
    else
        target = ev.target;
    
    if(target.handle)
    {
        overHandle = false;  
        if(pressed==false) 
            fixHorizontalPos(target.handle);
    }
}
function handleMoveEv(ev)
{
    if(pressed==true && overHandle == true)
    {
    var target;
    if(document.all)
        target = event.srcElement;
    else
        target = ev.target;
            
    var pos, mousePos,handleHalfWidth,handleWidth,barWidth;
    if(target.handle)
    {
        pos = getPosition(target);
        handleWidth  = target.handle.clientWidth;
        barWidth = target.clientWidth;
    }
    else
    {
        pos = getPosition(target.parentNode);
        handleWidth  = target.clientWidth;
        barWidth = target.parentNode.clientWidth;    
    }
    handleHalfWidth= handleWidth/2;
    mousePos = mouseCoords(ev);
    
    //document.title= "MouseX:"+mousePos.x+" HandleX:"+pos.x+" // POS: "+((mousePos.x-pos.x) + " // Min&MaxX: "+minX+":"+maxX);
    if((mousePos.x-pos.x-handleHalfWidth)>=minX && (mousePos.x-pos.x-handleHalfWidth)<=maxX)
    {    
            
        if(target.handle)
        {
            target.handle.style.left = ((mousePos.x-pos.x)-handleHalfWidth) + "px";
        }
        else
        {            
            target.style.left = ((mousePos.x-pos.x)-handleHalfWidth) + "px";
        }
    }
    }
}
function handleDocMouseMove(ev)
{
    var target;
    if(document.all)
        target = event.srcElement;
    else
        target = ev.target;
   
   if(target.step==null && target.handle==null && (pressed==true || overHandle==true))
   {
        pressed = false;
        overHandle = false;
       var handles = getElementsByClassName("handle","div");
       for(handleId in handles)
            fixHorizontalPos(handles[handleId]); 
   }
}
function containsClass(objClass, className)
{
    var classes = new Array();
    classes = objClass.split(" ");
    for(classId in classes)
    {
        if(classes[classId]==className)
         return true;
    }
    return false;
}
function getElementsByClassName(className, tagName)
{
    var tags = document.getElementsByTagName(tagName);
    var elements = new Array();
    var classes = new Array();
    
    for(var i=0;i<tags.length;i++)
    {
        if(tags[i].className!=null)
        {
            classes = tags[i].className.split(" ");       
            for(var j = 0; j < classes.length ; j++)
            {
                if(classes[j].className==className)
                {
                    elements.push(tags[i]);
                    break;
                }
            }
        }
    }
    return elements;
}
function handlePressedEv(ev)
{
   pressed = true;
}
function handleReleasedEv(ev)
{
    var handle;
    if(document.all)
        handle = event.srcElement;
    else
        handle = ev.target;
   pressed = false;
   
   if(handle.step==null)
    return;
    
    var barWidth = handle.parentNode.clientWidth;
    var stepSize = barWidth / (handle.parentNode.numSteps-1);
    var handleHalfWidth = handle.clientWidth/2; 
    currStep = 0;
    var posX = handle.offsetLeft+handleHalfWidth;
    while(currStep*stepSize < posX)
        currStep++;
    var difInf = posX - ((currStep-1)*stepSize);
    var difSup = ((currStep)*stepSize) - posX;
    
    handle.prevStep = handle.step;
    handle.step = (difSup<difInf?currStep:(currStep-1));
       
   fixHorizontalPos(handle);
}
function sliderClickedEv(ev)
{
    var target;
    if(document.all)
        target = event.srcElement;
    else
        target = ev.target;
    
    if(target.handle==null)
        return;

    var pos, mousePos;
    pos = getPosition(target.handle);
    posBar = getPosition(target);
    mousePos = mouseCoords(ev);
    
    //moveToStep(ev.target.handle,mousePos.x-posBar.x);
    
    
    if(pos.x > mousePos.x)
    {
        //ev.target.handle.style.left = (ev.target.handle.offsetLeft-50)+"px";
        moveStepLeft(target.handle);
    }
    else
    {
        //ev.target.handle.style.left = (ev.target.handle.offsetLeft+50)+"px"; 
        moveStepRight(target.handle);    
    }    
}
function moveStepLeft(handle)
{
    var newStep = handle.step;
    if(handle.step>0) 
        newStep --;
    else 
        return;

    var barWidth = handle.parentNode.clientWidth;
    var stepSize = barWidth / (handle.parentNode.numSteps-1);
    var handleHalfWidth = handle.clientWidth/2; 
    
    handle.style.left = ((newStep * stepSize)-handleHalfWidth)+"px";
    handle.prevStep=handle.step;
    handle.step = newStep;
    
    fixHorizontalPos(handle);
}
function moveStepRight(handle)
{
    var newStep = handle.step;
    if(handle.step<(handle.parentNode.numSteps-1)) 
        newStep ++;
    else 
        return;

    var barWidth = handle.parentNode.clientWidth;
    var stepSize = barWidth / (handle.parentNode.numSteps-1);
    var handleHalfWidth = handle.clientWidth/2; 
    
    handle.style.left = ((newStep * stepSize)-handleHalfWidth)+"px";
    handle.prevStep = handle.step;
    handle.step = newStep;
    
    fixHorizontalPos(handle);
}
function moveToStep(handle,step)
{
    handle.prevStep = handle.step;
    handle.step = step;
    
    fixHorizontalPos(handle);
}
function getPosition(e){	
	if(e==null)
	    	return {x:0,y:0};
	
	var left = 0;
	var top  = 0;

	while (e.offsetParent){
		left += e.offsetLeft;
		top  += e.offsetTop;
		e     = e.offsetParent;
	}

	left += e.offsetLeft;
	top  += e.offsetTop;

	return {x:left, y:top};
}
function getMouseOffset(target, ev){
	ev = ev || window.event;

	var docPos    = getPosition(target);
	var mousePos  = mouseCoords(ev);
	return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
}
function mouseCoords(e){
    var ev;
    if(document.all)
        ev = event;
    else
        ev = e;        
    
	if(ev.pageX || ev.pageY){
		return {x:ev.pageX, y:ev.pageY};
	}
	return {
		x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
		y:ev.clientY + document.body.scrollTop  - document.body.clientTop
	};
}
function clearSelection()
{
    var sel ;
    if(document.selection && document.selection.empty)
    {
        document.selection.empty() ;
    } 
    else if(window.getSelection) 
    {
        sel=window.getSelection();
        if(sel && sel.removeAllRanges)
            sel.removeAllRanges() ;
    }
}

function fixHorizontalPos(handle)
{
    if(handle.parentNode.enabledSteps[handle.step]!=null && handle.parentNode.enabledSteps[handle.step]==false)
        handle.step = handle.prevStep;

        clearSelection();
    
        var posX = parseInt(handle.style.left);
        if(handle.step==0)
            handle.style.left = (minX+1)+"px";
        else if(handle.step==(handle.parentNode.numSteps-1))
            handle.style.left = maxX+"px";
        else
        {
            var barWidth = handle.parentNode.clientWidth;
            var stepSize = barWidth / (handle.parentNode.numSteps-1);
            var handleHalfWidth = handle.clientWidth/2; 
    
            handle.style.left = ((handle.step * stepSize)-handleHalfWidth)+"px";
        }
        
        if(handle.step != handle.prevStep)
        {
            handle.parentNode.selFunction(handle.step,handle.parentNode.values[handle.step]);
        }
}

/* Tabbed Component */
var tabsToCollapse = new Array();
var tabsToExpand = new Array();
var animating = false;

function enableTabPanel(idTabPanel,defaultTab,headerBGColor,headerSelBGColor,expandSteps,collapseSteps)
{    
    var TabPanel = null;
    if(document.all)
        TabPanel = document.all[idTabPanel];
    else
        TabPanel = document.getElementById(idTabPanel);
    
    if(expandSteps==null)
        expandSteps = 12;
    if(collapseSteps==null)
        collapseSteps = 8;        
        
    var tabs = new Array();
    var childNodes = TabPanel.childNodes;
       
    for(var i = 0; i<childNodes.length; i++)
    {
        if(childNodes[i].tagName!=null && childNodes[i].tagName.toLowerCase() == "li")
        {
            tabs.push(childNodes[i]);
        }
    }
    
   
    if(tabs.length>0)
    {
        TabPanel.selectedTab = null;
        TabPanel.tabs = tabs;
         var selected;
         
        for(var j=0;j<tabs.length;j++)
        {            
            selected =((defaultTab-1) == j || defaultTab == 0);
            enableTabItem(tabs[j], selected,headerBGColor,headerSelBGColor,expandSteps,collapseSteps);    
        }
    }        
}
function enableTabItem(panelItem,selected,headerBGColor,headerSelBGColor,expandSteps,collapseSteps)
{    
    
    var item = panelItem.firstChild;
    
    while(item.tagName == null || item.tagName.toLowerCase() != "div")
        item = item.nextSibling;
    
    panelItem.header = item;
    item = item.nextSibling;
    while(item.tagName == null ||item.tagName.toLowerCase() != "div")
        item = item.nextSibling;
            
    panelItem.content = item;   
    panelItem.collapsed = true;
    panelItem.header.className="tabHeader";
    panelItem.header.panel=panelItem.parentNode;
    panelItem.header.panelItem=panelItem;
    panelItem.content.className="tabContent";
    panelItem.content.style.display="inline-block";
    
    panelItem.content.maxHeight = panelItem.content.clientHeight;    
     panelItem.content.expandSteps=expandSteps;
    panelItem.content.collapseSteps=collapseSteps;
    
    panelItem.content.style.display="none";
    panelItem.content.panel=panelItem.parentNode;
    panelItem.content.panelItem=panelItem;    
    panelItem.header.bgColor = headerBGColor;
    panelItem.header.selBgColor = headerSelBGColor;
    panelItem.header.onclick = headerAction;
    panelItem.header.onmousemove = overHeader;
    panelItem.header.onmouseout = outHeader;
    
    if(selected)
    {
        expandTab(panelItem);
    }
}
function overHeader(ev)
{
    var header = null;
     
    if(document.all)
        header = event.srcElement;
    else
        header = ev.target;

    header.style.backgroundColor = header.selBgColor;
}
function outHeader(ev)
{
    var header = null;
     
    if(document.all)
        header = event.srcElement;
    else
        header = ev.target;
    
    if(header.panelItem.collapsed==true)    
        header.style.backgroundColor = header.bgColor;
    else
        header.style.backgroundColor = header.selBgColor;
}
function collapseTabs(panel)
{
    for(tabId in panel.tabs)
    {
        collapseTab(panel.tabs[tabId]);
    }
}
function collapseTab(tab)
{
    if(tab.collapsed==false)
    {
        tab.collapsed = true; 
             
        tab.header.className="tabHeader";        
        tab.header.style.backgroundColor = tab.header.bgColor;
        tab.content.style.height = (tab.content.maxHeight - 24) + "px";
        addToCollapseTabs(tab.content);
      
        if(animating == false)
        {           
            setTimeout("animateTabs()",50);
        }
    }
}
function expandTab(tab)
{
    if(tab.collapsed==true)
    {
        tab.collapsed = false;
        tab.header.className="tabHeader tabHeaderSelected";
        tab.content.style.display = "block";
        tab.content.style.height = "0px";
        tab.content.style.paddingBottom = "0px";
        tab.content.style.paddingTop = "0px";
        
         addToExpandTabs(tab.content);
        
        if(animating == false)
        {           
           setTimeout("animateTabs()",50);
        }
    }
}
function addToExpandTabs(obj)
{
    for(var i=0;i<tabsToCollapse.length;i++)
    {
        if(tabsToCollapse[i]==obj)
        {
            tabsToCollapse.splice(i,1);
            break;
        }
    }
    tabsToExpand.push(obj);
}
function addToCollapseTabs(obj)
{
    for(var i=0;i<tabsToExpand.length;i++)
    {
        if(tabsToExpand[i]==obj)
        {
            tabsToExpand.splice(i,1);
            break;
        }
    }
    tabsToCollapse.push(obj);
}
function animateTabs()
{
    animating = true;
    var newSize = 0;
    var increment;
    for(var i = 0;  i<tabsToCollapse.length;i++)
    {             
            if(tabsToCollapse[i].style.height==null || tabsToCollapse[i].style.height=="")
            {
                 tabsToCollapse[i].style.height = (tabsToCollapse[i].maxHeight-24)+"px";
                 tabsToCollapse[i].style.paddingTop = "12px";
                 tabsToCollapse[i].style.paddingBottom = "12px";
            }
            increment = parseInt(tabsToCollapse[i].maxHeight/tabsToCollapse[i].collapseSteps);
            newSize = (parseInt(tabsToCollapse[i].style.height)-increment);
            
            if(newSize>0)
            {
                tabsToCollapse[i].style.height = newSize + "px";        
                 tabsToCollapse[i].style.paddingTop = parseInt(parseInt(tabsToCollapse[i].style.paddingTop)-1) + "px";
                tabsToCollapse[i].style.paddingBottom = parseInt(parseInt(tabsToCollapse[i].style.paddingBottom)-1) + "px";
            }
            else
            {
                tabsToCollapse[i].style.display = "none";
                tabsToCollapse[i].style.paddingTop = "12px";
                tabsToCollapse[i].style.paddingBottom = "12px";
                tabsToCollapse[i].style.height = (tabsToCollapse[i].maxHeight-24)+"px";                
                tabsToCollapse.splice(i,1);
                i--;
            }        
    }   
   
    for(var i = 0;  i<tabsToExpand.length;i++)
    {            
        
            if(tabsToExpand[i].style.height==null || tabsToExpand[i].style.height=="")
            {
                 tabsToExpand[i].style.height = "0px";
                 tabsToExpand[i].style.paddingTop = "12px";
                 tabsToExpand[i].style.paddingBottom = "12px";
            }
            
            increment = parseInt(tabsToExpand[i].maxHeight/tabsToExpand[i].expandSteps);
            newSize = (parseInt(tabsToExpand[i].style.height)+increment);
                    
            if(tabsToExpand[i].clientHeight < tabsToExpand[i].maxHeight)
            {
                tabsToExpand[i].style.height = newSize + "px";
                if(parseInt(tabsToExpand[i].style.paddingTop)<12)
                {        
                    tabsToExpand[i].style.paddingTop = parseInt(parseInt(tabsToExpand[i].style.paddingTop)+1) + "px";
                    tabsToExpand[i].style.paddingBottom = parseInt(parseInt(tabsToExpand[i].style.paddingBottom)+1) + "px";
                }
            }
            
            if(tabsToExpand[i].clientHeight >= tabsToExpand[i].maxHeight)
            {                                
                tabsToExpand[i].style.paddingTop = "12px";                
                tabsToExpand[i].style.paddingBottom = "12px";                                
                tabsToExpand[i].style.height = "auto";                       
                tabsToExpand.splice(i,1);
                i--;                
            }
    }    
    if(tabsToExpand.length==0 && tabsToCollapse.length==0)
        animating = false;
    else
        setTimeout("animateTabs()",50);      
}
function headerAction(ev)
{
    var header = null;
     
    if(document.all)
        header = event.srcElement;
    else
        header = ev.target;
    
    if(header.panelItem.collapsed)
    {
        collapseTabs(header.panel);
        expandTab(header.panelItem);
    }
    else
    {
        collapseTab(header.panelItem);
    }
}
function clipDDLs()
    {
        if(document.all==null || typeof document.body.style.maxHeight != "undefined") // If IE7/firefox/opera/safari... not need to clip
            return;
        else
        {
            var selects = document.getElementsByTagName("select");
            for(var i=0;i<selects.length;i++)
                selects[i].style.visibility = "hidden";                
        }
    }
    function unclipDDLs()
    {
        if(document.all==null || typeof document.body.style.maxHeight != "undefined")
            return;
        else
        {
            var selects = document.getElementsByTagName("select");
            for(var i=0;i<selects.length;i++)
                selects[i].style.visibility = "visible";                
        }
    }
    
    function agree()
    {           
        (document.all!=null?document.all["accept"]:document.getElementById("accept")).checked=true;

	var acceptErr=document.getElementById("error3");
	acceptErr.style.display="none";
	acceptErr.parentNode.style.backgroundColor = okColor;

    }
	
	function openSquareFootageWindow() 
	{
	window.open("squareFootageExplained.htm","squareFootage","menubar=1,resizable=1,width=315,height=350");
	}
    
	function openOutHouseCostWindow() 
	{
	window.open("outHouseCostsExplained.htm","outHouseCost","menubar=1,resizable=1,width=300,height=150");
	}
	
     // MDC-LANSA JS Code

    function RetrieveSavedQuote()
    {        
        if(validateRetrieve()==true)
        {
            var ModParm1=window.document.retrieve_form.IIREF.value;
            var ModParm2='RYN';
            var ModParm3='R';
            var link ="https://www.ryanaircarinsurance.com/cgi-bin/LANSAWEB?procfun+IIPROCmot+IIFNM01+FWL+FUNCPARMS+IIREF(A0060):" + ModParm1 + "+IICOCD(A0030):" + ModParm2 + "+STDRENTRY(A0010):" + ModParm3;
            document.retrieve_form.action = link;
            document.retrieve_form.submit();
        }
        return false;
    }
    
    function QuoteMe()
    {
        if(validateInstant()==true)
        {
            var ModParm1=window.document.instant_quote_form.IIAGCD.value;
            var ModParm2=(window.document.instant_quote_form.IIGNCD[0].checked?"M":"F");            
            var ModParm3=window.document.instant_quote_form.IINCCD.value;
            var ModParm4=window.document.instant_quote_form.IILICD.value;
            var ModParm5=window.document.instant_quote_form.IIARCD.value;
            var ModParm6=window.document.instant_quote_form.IIERCD.value;

            var ModParm7='RYN';

            var ModParm8=window.document.instant_quote_form.IIVAL.value;
            var ModParm9=window.document.instant_quote_form.IITAC.value;
            var ModParm10='N';
            var link ="https://www.ryanaircarinsurance.com/cgi-bin/LANSAWEB?procfun+IIPROCmot+IIFNM01+FWL+FUNCPARMS+IIAGCD(S0020):" + ModParm1 + "+IIGNCD(A0010):" + ModParm2 + "+IINCCD(A0060):" + ModParm3 + "+IILICD(A0020):" + ModParm4 + "+IIARCD(A0020):" + ModParm5 + "+IIERCD(A0020):" + ModParm6 + "+IICOCD(A0030):" + ModParm7 + "+IIVAL(S0060):" + ModParm8 + "+IITAC(A0010):" + ModParm9 + "+STDRENTRY(A001):" + ModParm10; 

            document.instant_quote_form.action = link;
            document.instant_quote_form.submit();
        }
        return false;
    }
	


    function createCookie(firstname,days)
    {
        /*if (days) {
            var date = new Date();
            date.setTime(date.getTime()+(days*24*60*60*1000));
            var expires = "; expires="+date.toGMTString();
        }
        else var expires = "";
        document.cookie = "FBD_USER_FIRSTNAME="+firstname+expires+"; path=/";
		*/
    }
    
    function eraseCookie()
    {
        //createCookie("",-1);
    }
    
    function checkForCookie()
    {
        //createCookie("Peadar",1);
    
		/*
        var firstName = "";
        
        var nameEQ = "FBD_USER_FIRSTNAME=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(length,c.length);
            if (c.indexOf(nameEQ) == 0) firstName = c.substring(nameEQ.length,c.length);
        }
        
        if(firstName != "")
        {
            document.getElementById("savedQuotesLink").style.display = "block";
            document.getElementById("userGreeting").innerHTML = "Hello " + firstName;
            document.getElementById("userGreeting").style.display = "block";
            document.getElementById("talkToUsLink").className = "";
        }
        */
        //eraseCookie();
    }
	
function ShowRetrievePopUp()
{
	document.getElementById('RetrievePopUp').style.display='block';
}
function HideRetrievePopUp()
{
	document.getElementById('RetrievePopUp').style.display='none';
}			
	
	
function alphanumeric(alphane)
			{
			var numaric = alphane;
			for(var j=0; j<numaric.length; j++)
			{
			var alphaa = numaric.charAt(j);
			var hh = alphaa.charCodeAt(0);
			
			if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
			{				
			}
			else {
				if(j == 3 && hh == 32){
				}
				else{
					return false;
				}
			}
			}
			return true;
			}
			
function trim(stringToTrim) 

{
return stringToTrim.replace(/^\s+|\s+$/g,"");
}       
        
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



