﻿var pos = 0;
function popup(mypage, myname, w, h, scroll) 
	{
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
		win = window.open(mypage, myname, winprops)
		if (parseInt(navigator.appVersion) >= 4) 
		{ 
			win.window.focus(); 
		}
	}
function Swap(strObj,strImg)
{
    document.getElementById(strObj).src = "images/" + strImg;
}
function PopUp(strUrl,strWidth,strHeight)
{
        open(strUrl, "Popup", "width=" + strWidth + ", height=" + strHeight + ", top=100, left=300, scrollbars=1,resizable=1,menubar=1");
}
function GetPos(objBody) 
{
    if (objBody.createTextRange)
    { 
      //  objBody.caretPos = document.selection.createRange().duplicate();
      pos = document.selection.createRange().duplicate();
      alert(pos);
    }
}
function Insert(objBody, strText) 
{
    if (objBody.createTextRange && objBody.caretPos) 
    {
         var caretPos = objBody.caretPos;
         caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? strText + ' ' : strText;
    }
    else
    {
        textEl.value  = text;
    }
}

function insertAtCursor(myField, myValue) 
{
    if (document.selection) 
    {
        myField.focus();
        var sel = document.selection.createRange();
        sel.text = myValue;
    }
    else if (myField.selectionStart || myField.selectionStart == '0') 
    {
        var startPos = myField.selectionStart;
        var endPos = myField.selectionEnd;
        myField.value = myField.value.substring(0, startPos) + myValue+ myField.value.substring(endPos, myField.value.length);
    }
    else 
    {
        myField.value += myValue;
    }
}
function ValidateAgree(objName)
{
    if(document.getElementById(objName).checked != true)
    {
        alert("You must agree to the terms and conditions before continuing.");
        return false;
    }
}
function OpenMap(objStreet,objZip)
{
    var strUrl = "http://maps.google.com/maps?daddr=110 W Bankhead St, 38652&saddr=";
    var strStreet = document.getElementById(objStreet).value;
    var strZip = document.getElementById(objZip).value;
    //strUrl = strUrl + strStreet & ", " & strZip;
    PopUp(strUrl+strStreet + ", " + strZip,"700","500"); 
}
