/*
* This file contains all the common Javascript methods that are used in Contact us pages
* callURL method is called when the user clicks on each link in the page
*/

 var frmPath="/contactus/";
 var frmList = new Array();
 var frmMailBoxes = new Array();
 var frmNames = new Array();

                function callURL(objH3, contextPath){

						var re = new RegExp(contextPath);
						var m = re.exec(frmPath);
						if (m == null) {
							frmPath = contextPath + frmPath;
						} else {
							//Nothing
						}

						//frmPath = contextPath + frmPath;
                        var h2Val="";
                        var selectedForm="";
                        var h3 = objH3.id;
                        var frmObj= objH3.parentNode.parentNode;
						//alert("HI"+frmObj.name);
                        var frmName=frmObj.name;
                        var obj= eval ('document.'+frmName+'.h2');
                        for (i=0; i<frmObj.childNodes.length;i++){
                                if (frmObj.childNodes[i].nodeName=="H2"){
                                        h2Val=frmObj.childNodes[i].innerHTML;
                                        frmObj.h2.value=h2Val;
                                }
                        }
                        frmObj.h3.value = objH3.innerHTML;

                        var h1Value=document.getElementById("h1Heading").innerHTML;;
                        var specialDash=String.fromCharCode(8211); // wierd dash symbol (en-dash)
                        h1Value=h1Value.replace(specialDash, "&ndash;");
                        specialTM=String.fromCharCode(8482);  // trademark symbol                        
                        h1Value=h1Value.replace(specialTM, "&trade;");
                        frmObj.h1.value=h1Value;
                        
                        //frmObj.h1.value= "Contact Us -- Facilities";
                        for (i=0;i<frmNames.length;i++){
                                
                                if (frmNames[i]==h2Val){
                                        if (frmList[i].indexOf("http") < 0)
                                                selectedForm=frmPath+frmList[i];
                                        else
                                                selectedForm=frmList[i];
                                        frmObj.h4.value = frmMailBoxes[i];
                                }
                        }
                       // alert (selectedForm);
                        //alert (frmObj.h4.value);
                        if (sNbr.length  > 0) {
                                if (selectedForm.indexOf ("?") > -1)
                                        selectedForm=selectedForm + "&storenumber=" + sNbr;
                                else
                                        selectedForm=selectedForm + "?storenumber=" + sNbr;
                        }

                        //alert (selectedForm);
                        frmObj.action=selectedForm;
                        frmObj.method="post";
                        frmObj.submit();
                }