﻿
function CopyAddress_XCV()
{
    PageMethods.CopyAddress();
}

    function CopyAddress()
{
var txtPerAdd1 =  getElementId("txtPerAdd1");
var txtPerAdd2=  getElementId("txtPerAdd2"); 
var   txtPerTown=   getElementId("txtPerTown");
var  txtPerProvince=   getElementId("txtPerProvince");
var  ddlPerCountry=   getElementId("ddlPerCountry");

var  txtCurAdd1=getElementId("txtCurAdd1");
var  txtCurAdd2=  getElementId("txtCurAdd2");
var   txtCurTown=  getElementId("txtCurTown");
var  txtCurProvince=  getElementId("txtCurProvince");
var  ddlCurCountry= getElementId("ddlCurCountry");

    if (txtPerAdd1!=null && txtCurAdd1!=null)
    {
        txtCurAdd1.value = txtPerAdd1.value;
    }

    if(txtPerAdd2!=null && txtCurAdd2!=null )
     {
        txtCurAdd2.value = txtPerAdd2.value;
    }

if(txtPerTown!=null && txtCurTown!=null )
{txtCurTown.value = txtPerTown.value;
}
if(txtPerProvince!=null && txtCurProvince!=null )
{txtCurProvince.value = txtPerProvince.value;
}
if(ddlPerCountry!=null && ddlCurCountry!=null )
{
  ddlCurCountry.value = ddlPerCountry.options[ddlPerCountry.selectedIndex].value;
  
}

}
function test()
{alert('test');}
   
function CopyAddressLocation()
{
//var   txtCurTown=  getElementId("txtCurTown");
//var  txtCurProvince=  getElementId("txtCurProvince");
//var  ddlCurCountry= getElementId("ddlCurCountry");
    var txtCurTown = getElementIdMapSection("txtCurTown");
    var txtCurProvince = getElementIdMapSection("txtCurProvince");
    var ddlCurCountry = getElementIdMapSection("ddlCurCountry");

var   txtSearchTown=  getElementIdMapSection("txtSearchTown");
var  txtSearchProvince=  getElementIdMapSection("txtSearchProvince");
var  txtSearchCountry= getElementIdMapSection("txtSearchCountry");

  if(txtSearchTown!=null && txtCurTown!=null )
{ txtSearchTown.value = txtCurTown.value;
}
if(txtSearchProvince!=null && txtCurProvince!=null )
{txtSearchProvince.value = txtCurProvince.value;
}
if(txtSearchCountry!=null && ddlCurCountry!=null )
{
  txtSearchCountry.value = ddlCurCountry.options[ddlCurCountry.selectedIndex].value;
  
}
}   
   
function getElementId(s)
{
    var masterpage;
    masterpage = 'ctl00_othersection_';
    return document.getElementById(masterpage + s);   
}

function getElementIdMapSection(s)
{
    var masterpage;
    masterpage = 'ctl00_mapSection_';
    return document.getElementById(masterpage + s);   
}

function OnGetForecast(pageIndex) {
    var batch = 1990;
    var branch = null;
    var fname = null;
    var lname = null;
    var location = null;
    if (pageIndex == null)
        pageIndex = 1;
        
    var ddlBatch = getElementId("ddlBatch");
    if (ddlBatch != null) {
        batch = ddlBatch.options[ddlBatch.selectedIndex].value;
    }

    var ddlBranch = getElementId("ddlBranch");
    if (ddlBranch != null) {
        branch = ddlBranch.options[ddlBranch.selectedIndex].value;
    }

    var txtFirstname = getElementId("txtFirstname");
    if (txtFirstname != null) {
        fname = txtFirstname.value;
    }

    var txtLastname = getElementId("txtLastname");
    if (txtLastname != null) {
        lname = txtLastname.value;
    }

    var txtLocation = getElementId("txtLocation");
    if (txtLocation != null) {
        location = txtLocation.value;
    }
     
     
   var args= new Array(pageIndex, batch, branch, fname, lname,location);

  // WitWay.WebService.WitwayService.GetAlumni(args, OnGetForecastComplete, OnError);
   
}

function searchById(ids) {
   // WitwayService.GetAlumniById(ids, OnGetForecastComplete, OnError);
    alert(ids);
}

function OnGetForecastComplete(result) {

    var r = getElementId("weatherResult")
     r.innerHTML = result;
}

function OnError(result) {

    alert(result.get_message());

}

function panToLatLong(lat,lon) {

    var txtlat = getElementId("hdnLat");
    var txtlon = getElementId("hdnLong");

    if (txtlat != null && txtlon != null) {
        txtlat.value = lat;
        txtlon.value = lon;
    }
    
//    
//    var btn = getElementId("Button1");
//    
//    //btn.click();

//    var cMapControlID = getElementIdMapSection("mymap");
//    var mymap = null;
//    if (cMapControlID != null) {
//        mymap = cMapControlID.get_VEMap();
//    }
 

}

function validateInputs() {

    var spLocCountry = getElementIdMapSection("spLocCountry");
    var txtLocCountry = getElementIdMapSection("txtLocCountry");

    if (spLocCountry != null && txtLocCountry != null) {
        if (txtLocCountry.value == "use the Find function on the left") {
            spLocCountry.visibility = 'visible';
            return false;
        }
        else {
            spLocCountry.visibility = 'hidden';
            return true;
        }
    }
    return false;
}
function searchByLocation(lat, lon) {

}


