﻿// JScript File

       myWaitpostcode = "<table width='100%' align='center' style='border-width:3pt;border-color:#ffffff;border-style:solid'  cellpadding='20' cellspacing='0'><tr valign='middle'><td width='50%'><IMG SRC='../../images/spacer.gif' width='1pt' height='360pt' /></td><td><IMG SRC='../../images/general/pleasewait.gif' align='center' ALT=''></td><td width='50%'>&nbsp;</td></tr></table>"
       myWaitpostcode2 = "<table width='100%' align='center' style='border-width:3pt;border-color:#ffffff;border-style:solid'  cellpadding='20' cellspacing='0'><tr valign='middle'><td width='50%'><IMG SRC='../../images/spacer.gif' width='1pt' height='120pt' /></td><td><IMG SRC='../../images/general/pleasewait.gif' align='center' ALT=''></td><td width='50%'>&nbsp;</td></tr></table>"
       myWaitpostcode3 = "<table width='100%' align='center' style='border-width:3pt;border-color:#ffffff;border-style:solid'  cellpadding='20' cellspacing='0'><tr valign='middle'><td width='50%'><IMG SRC='../../images/spacer.gif' width='1pt' height='20pt' /></td><td><IMG SRC='../../images/icons/please_wait.gif' align='center' ALT=''></td><td width='50%'>&nbsp;</td></tr></table>"
       myWaitpostcode4 = "<IMG SRC='../../images/icons/please_wait.gif' align='center' ALT=''>"
       
       var myArgGloabal;
        
       function getCommunities(){
                    myArgGloabal = "a"
                    var myCountry1 = document.getElementById("country_1");
                    var myCountry2 = document.getElementById("country_2");
                    var myCountry3 = document.getElementById("country_3");
                    if (myCountry1.checked){
                    myCountry = "au"
                    }
                    else
                    {
                        if (myCountry2.checked){
                            myCountry = "us"
                        }
                        else
                        {
                            myCountry = "gb"
                        }
                    }
//                    var myType = document.getElementById("org_type_1");
//                    if (myType.checked){
//                    myType = "p"
//                    }
//                    else
//                    {
//                    myType = "s"
//                    }
                    myTarget = document.getElementById("postcode");
                    myTargetTag = myTarget.value; 
                    myTarget2 = document.getElementById("section1_display");
                    myTarget2.innerHTML =  myWaitpostcode2
                    location.href="#top";
                    UseCallback_Communities("get|" + myCountry + "p" + myTargetTag);
        }

       function GetCommunitiesFromServer(TotalStr, context){
             //   alert(TotalStr);
                    if (myArgGloabal == "a"){
                    myTarget = document.getElementById("section1_display");
                    myTarget.innerHTML =  TotalStr
                    }
                    else
                    {
                            if (myArgGloabal == "f"){
                            myTarget = document.getElementById("class_div");
                            myTarget.innerHTML =  TotalStr
                            }
                            else
                            {
                                if (myArgGloabal == "r"){
                                myTarget = document.getElementById(TotalStr);
                                myTarget.outerHTML =  ""
                                }
                                else
                                {
                                myTarget = document.getElementById("community_selected");
                                myTarget.innerHTML =  TotalStr
                                }
                            }
                    }
       }
       
              function addCommunities(myArg, myArg2, myArg3){
              
                 if (confirm("Do you want join this community?")) {
                 //alert("yes")
                    myArgGloabal = "b";
                    myTarget = document.getElementById("community_selected");
                    myTarget.innerHTML =  
                    location.href="#top";
                    UseCallback_Communities("add|" + myArg + "|" + myArg2 + "|" + myArg3);
                 } 
                 else 
                 {
                 //alert("no")
                 }              

        }
       
       
              function currentCommunities(){
         //     alert("hello")
                    myArgGloabal = "c";
                    myTarget = document.getElementById("community_selected");
                   myTarget.innerHTML =  myWaitpostcode
                    location.href="#top";
                    UseCallback_Communities("cur|");
        }
       
       
           function openComDiv(myArg)
          {
               var PrivacyInfo = document.getElementById(myArg);
               var PrivacyPlus = document.getElementById("plus_" + myArg);
               PrivacyInfo.style.display = (PrivacyInfo.style.display == "none")?"inline":"none";
               PrivacyPlus.innerHTML = (PrivacyPlus.innerHTML == "+")?"–":"+";
          }
          
         function findClass(para1, para2){
                    myArgGloabal = "f";
                    var myClassYear = document.getElementById("class_year").value;
                    myTarget2 = document.getElementById("class_div");
                  //  alert(para1 + "|" + myClassYear);
                    myTarget2.innerHTML =  myWaitpostcode3;
                    UseCallback_Communities("class|" + para1 + "|" + myClassYear + "|" + para2);
        }

         function removeAssociation(para1, para2){
        
                 if (confirm("Do you want to break your association with this community?")) {
                    myArgGloabal = "r";
                    myTarget2 = document.getElementById("remove_div_" + para1 + "_" + para2);
                    myTarget2.innerHTML =  myWaitpostcode4;
                    UseCallback_Communities("remove`" + para1 + "`" + para2);
                 } 
                 else 
                 {
                 //alert("no")
                 }  

        }