var $strGloHostName = "";
var SiteAddOps_xmlHttp;
var SiteApproaches_xmlHttp;
var SiteContexts_xmlHttp;
var EnquiryForm_xmlHttp;
var Legals_xmlHttp;
var Voucher_xmlHttp;
var UserDetails_xmlHttp;
var CreativeDetails_xmlHttp;
var Regions_xmlHttp;
var RegionsMenu_xmlHttp;
var SiteDetails_xmlHttp;
var ContextsMenu_xmlHttp;
var OptionsMenu_xmlHttp;
var SearchRes_xmlHttp;


function EnterNewAdvertiser(strParams)
{

   var r=confirm("You are about to Register a new advertiser.  Please confirm.");
              if (r==false)
              {

              return;
              }

   var strEmail = document.getElementById("LGselemail").value;
   
   if (strEmail=="")
     {
     alert ("Please enter an email address for the new advertiser.");
     return;
     }

   SearchRes_xmlHttp=GetXmlHttpObject();
     if (SearchRes_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APregisternewadvertiser.php";
   url = url+strParams;
   url = url+"&ADBUS="+document.getElementById("LGselAd").value;
   url = url+"&ADEMS="+document.getElementById("LGselemail").value;
   url = url+"&ADCNTCT="+document.getElementById("LGselcontact").value;
   url = url+"&ADTEL="+document.getElementById("LGselphone").value;

     SearchRes_xmlHttp.onreadystatechange=SearchRes_stateChanged;
     SearchRes_xmlHttp.open("GET",url,true);
     SearchRes_xmlHttp.send(null);


    var strHtml = '<font color="0000#FF">Please wait while registration runs...<p></font>';
    document.getElementById("AdvertiserDets").innerHTML=strHtml;

}

function SetAdvertiser(strParams)
{
   SearchRes_xmlHttp=GetXmlHttpObject();
     if (SearchRes_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APadvertiserset.php";
   url = url+strParams;
   url = url+"&AID="+document.getElementById("RegAdList").value;

     SearchRes_xmlHttp.onreadystatechange=SearchRes_stateChanged;
     SearchRes_xmlHttp.open("GET",url,true);
     SearchRes_xmlHttp.send(null);


    var strHtml = '<font color="0000#FF">Please wait while search runs...<p></font>';
    document.getElementById("AdvertiserDets").innerHTML=strHtml;

}


function SearchAdDomain(strParams)
{
   SearchRes_xmlHttp=GetXmlHttpObject();
     if (SearchRes_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APadvertiseremailsearch.php";
   url = url+strParams;
   url = url+"&EMS="+document.getElementById("LGdomainSearch").value;

     SearchRes_xmlHttp.onreadystatechange=SearchRes_stateChanged;
     SearchRes_xmlHttp.open("GET",url,true);
     SearchRes_xmlHttp.send(null);


    var strHtml = '<font color="0000#FF">Please wait while search runs...<p></font>';
    document.getElementById("AdvertiserDets").innerHTML=strHtml;

}

function SearchRes_stateChanged()
{
if (SearchRes_xmlHttp.readyState==4)
  {

   document.getElementById("AdvertiserDets").innerHTML=SearchRes_xmlHttp.responseText



  }
}

function SelectSite(strParams, intSiteID, intContextID, intOptionID)
{
   SiteDetails_xmlHttp=GetXmlHttpObject();
     if (SiteDetails_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APivsiteaddops.php";
   url = url+strParams;
   url = url+"&SID="+intSiteID;
   url = url+"&CID="+intContextID;
   url = url+"&AID="+intOptionID;


     SiteDetails_xmlHttp.onreadystatechange=SiteDetails_stateChanged;
     SiteDetails_xmlHttp.open("GET",url,true);
     SiteDetails_xmlHttp.send(null);


    var strHtml = '<font color="0000#FF">Please wait while specific site opportunities load...<p></font>';
    document.getElementById("MainContentArea").innerHTML=strHtml;
    
    BuildContextsMenu(strParams, intSiteID, intContextID);
    
    BuildOptionsMenu(strParams, intSiteID, intContextID, intOptionID);


}

function SiteDetails_stateChanged()
{
if (SiteDetails_xmlHttp.readyState==4)
  {

   document.getElementById("MainContentArea").innerHTML=SiteDetails_xmlHttp.responseText
   


  }
}


function RaiseRequestToChangeCampaign(strParams, intSiteID)
{
  alert("Sorry.  This service is currently off-line for maintenance.  Please raise an enquiry if you need to make changes to a campaign.")
}

function GetCreativeApprovalStatus(strParams, intSiteID, intCampStatus)
{
     CreativeDetails_xmlHttp=GetXmlHttpObject();
     if (CreativeDetails_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APgetcreativedets.php";
   url = url+strParams;
   url = url+"&CRID="+document.getElementById("CreativeList").value;
   url = url+"&SID="+intSiteID;
   url = url+"&STTS="+intCampStatus;

     CreativeDetails_xmlHttp.onreadystatechange=CreativeDetails_stateChanged;
     CreativeDetails_xmlHttp.open("GET",url,true);
     CreativeDetails_xmlHttp.send(null);


    var strHtml = '<font color="0000#FF">Please wait while creative details load...<p></font>';
    document.getElementById("CreativeRefMsg").innerHTML=strHtml;
}

function CreativeDetails_stateChanged()
{
if (CreativeDetails_xmlHttp.readyState==4)
  {

    document.getElementById("CreativeAppStatus").innerHTML=CreativeDetails_xmlHttp.responseText
    var strHtml = "";
    document.getElementById("CreativeRefMsg").innerHTML=strHtml;

  }
}

function FillInCampSettingsPage(strParams)
{

 var strLogInMessage = "Your session has timed out.  Please log-in again.";

 BuildUserDetailsSection(strParams, strLogInMessage)

 BuildEnquirySection(strParams);
 BuildLegalsSection(strParams);

}

function FillInDashboardPage(strParams)
{

 var strLogInMessage = "Your session has timed out.  Please log-in again.";

 BuildUserDetailsSection(strParams, strLogInMessage)

 BuildEnquirySection(strParams);
 BuildLegalsSection(strParams);

}

function FillInCampaignViewPage(strParams, strLogInMessage)
{

 BuildUserDetailsSection(strParams, strLogInMessage)

 BuildEnquirySection(strParams);
 BuildLegalsSection(strParams);

}


function FillInTenancybuilderPage(strParams)
{

 BuildVoucherSection(strParams);
 BuildEnquirySection(strParams);
 BuildLegalsSection(strParams);

}

function FillInTenancyviewPage(strParams)
{

 BuildVoucherSection(strParams);
 BuildEnquirySection(strParams);
 BuildLegalsSection(strParams);

}

function FillInRegionOverviewPage(strParams)
{


 BuildVoucherSection(strParams);
 BuildRegionContentSection(strParams, 0);
 BuildRegionSection(strParams, 0);
 BuildContextsSection(strParams, 0);
 BuildApproachesSection(strParams, 0);
 BuildEnquirySection(strParams);
 BuildLegalsSection(strParams);

}

function FillInSiteOverviewPageiv(strParams, strLogInMessage)
{

 BuildContextsMenu(strParams, 0);
 BuildUserDetailsSection(strParams, strLogInMessage);
 BuildEnquirySection(strParams);
 BuildLegalsSection(strParams);
 PreBuildSiteMenu();
 BuildOptionsMenu(strParams, 0, 0, 0)


}

function SelectRegion(strParams, intRegionID, imNum)
{

  switch(intRegionID)
  {
  case 0:
  document.getElementById("UKmapImage").src = "resources/UKmap.png"
  Image1.src = "resources/UKmap.png";
  break;
  case 1:
  document.getElementById("UKmapImage").src = Image7.src;
  Image1.src = Image7.src;
  break;
  case 2:
  document.getElementById("UKmapImage").src = Image6.src;
  Image1.src = Image6.src;
  break;
  case 3:
  document.getElementById("UKmapImage").src = Image8.src;
  Image1.src = Image8.src;
  break;
  case 4:
  document.getElementById("UKmapImage").src = Image5.src;
  Image1.src = Image5.src;
  break;
  case 5:
  document.getElementById("UKmapImage").src = Image10.src;
  Image1.src = Image10.src;
  break;
  case 6:
  document.getElementById("UKmapImage").src = Image11.src;
  Image1.src = Image11.src;
  break;
  case 7:
  document.getElementById("UKmapImage").src = Image14.src;
  Image1.src = Image14.src;
  break;
  case 8:
  document.getElementById("UKmapImage").src = Image13.src;
  Image1.src = Image13.src;
  break;
  case 9:
  document.getElementById("UKmapImage").src = Image12.src;
  Image1.src = Image12.src;
  break;
  case 10:
  document.getElementById("UKmapImage").src = Image3.src;
  Image1.src = Image3.src;
  break;
  case 11:
  document.getElementById("UKmapImage").src = Image2.src;
  Image1.src = Image2.src;
  break;
  case 12:
  document.getElementById("UKmapImage").src = Image4.src;
  Image1.src = Image4.src;
  break;
  case 13:
  document.getElementById("UKmapImage").src = Image13.src;
  Image1.src = Image3.src;
  break;
  case 14:
  document.getElementById("UKmapImage").src = Image14.src;
  Image1.src = Image14.src;
  break;
}


  if(intRegionID == '0')
  {
  var strMenuList = '<a href="#" onmouseover="mopen(\'m1\')" onmouseout="mclosetime()">Available regions</a><br>';

   strMenuList = strMenuList+'<div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">';
   strMenuList = strMenuList+'<div id="MenuList_sites" style="z-index: 3; position: absolute; left: 0px; top: 0px;" >';

   strMenuList = strMenuList+document.getElementById("RegionList").innerHTML;

   strMenuList = strMenuList+'</div></div>';

   document.getElementById("SiteList").innerHTML = strMenuList;
   
   var strGeneralStats = "<h4>";
   strGeneralStats = strGeneralStats+document.getElementById("NetStats").innerHTML+"</h4><br><p>";
   strGeneralStats = strGeneralStats+"Please select a region from the map opposite for more detailed traffic stats and to view opportunities in that region.";
   
   document.getElementById("MainContentArea").innerHTML = strGeneralStats;
  }
  else
  {

  var strRegionDivName = 'reg'+intRegionID;

  var strMenuList = '<a href="#" onmouseover="mopen(\'m1\')" onmouseout="mclosetime()">Sites in Region</a><br>';

   strMenuList = strMenuList+'<div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">';
   strMenuList = strMenuList+'<div id="MenuList_sites" style="z-index: 3; position: absolute; left: 0px; top: 0px;" >';

   strMenuList = strMenuList+document.getElementById(strRegionDivName).innerHTML;

   strMenuList = strMenuList+'</div></div>';

   document.getElementById("SiteList").innerHTML = strMenuList;

   strMenuList = document.getElementById(strRegionDivName).innerHTML;
   document.getElementById("MainContentArea").innerHTML = strMenuList;

   }

   ClearSelections(strParams, 1, 0, 0);

}

function ClearSelections(strParams, intClearSite, intClearContext, intClearRegion)
{
    if(intClearSite == 1)
    {
    BuildContextsMenu(strParams, 0, 0);
    }
    
    if(intClearContext == 1)
    {

    }
    
    if(intClearRegion == 1)
    {
    SelectRegion(strParams, 0, 0)
    }
}

function BuildOptionsMenu(strParams, intSiteID, intContextID, intOptionID)
{

           
      OptionsMenu_xmlHttp=GetXmlHttpObject();
    
     if (OptionsMenu_xmlHttp==null)
     {
     alert("Sorry.  Your browser is not compatible with the loGo_net selector.");
     }

     var url=$strGloHostName+"/API/APoptionsformenu.php";
     url = url+strParams;
     url = url+"&SID="+intSiteID;
     url = url+"&CID="+intContextID;
     url = url+"&AID="+intOptionID;


     document.getElementById("OptionList").innerHTML = "Please wait.  Advertising options loading....";

     OptionsMenu_xmlHttp.onreadystatechange=OptionsMenu_stateChanged;
     OptionsMenu_xmlHttp.open("GET",url,true);
     OptionsMenu_xmlHttp.send(null);
}

function OptionsMenu_stateChanged()
{
if (OptionsMenu_xmlHttp.readyState==4)
  {

   document.getElementById("OptionList").innerHTML=OptionsMenu_xmlHttp.responseText;

  }
}


function BuildContextsMenu(strParams, intSiteID, intContextID)
{

     ContextsMenu_xmlHttp=GetXmlHttpObject();
     if (ContextsMenu_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

     var url=$strGloHostName+"/API/APcontextsformenu.php";
     url = url+strParams;
     url = url+"&SID="+intSiteID;
     url = url+"&CID="+intContextID;

     document.getElementById("ContextMenuList").innerHTML = "Please wait.  Available contexts loading....";

     ContextsMenu_xmlHttp.onreadystatechange=ContextsMenu_stateChanged;
     ContextsMenu_xmlHttp.open("GET",url,true);
     ContextsMenu_xmlHttp.send(null);
     

}

function ContextsMenu_stateChanged()
{
if (ContextsMenu_xmlHttp.readyState==4)
  {

   document.getElementById("ContextMenuList").innerHTML=ContextsMenu_xmlHttp.responseText;

  }
}

function PreBuildSiteMenu()
{

    document.getElementById("SiteList").innerHTML = "Please wait.  Available regions loading....";

     RegionsMenu_xmlHttp=GetXmlHttpObject();
     if (RegionsMenu_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

     var url=$strGloHostName+"/API/APsitesformenu.php";

     RegionsMenu_xmlHttp.onreadystatechange=RegionsMenu_stateChanged;
     RegionsMenu_xmlHttp.open("GET",url,true);
     RegionsMenu_xmlHttp.send(null);
     

     
     

}

function RegionsMenu_stateChanged()
{
if (RegionsMenu_xmlHttp.readyState==4)
  {

   document.getElementById("PreBuiltSites").innerHTML=RegionsMenu_xmlHttp.responseText
   
  var strMenuList = '<a href="#" onmouseover="mopen(\'m1\')" onmouseout="mclosetime()">Available regions</a><br>';

   strMenuList = strMenuList+'<div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">';
   strMenuList = strMenuList+'<div id="MenuList_sites" style="z-index: 3; position: absolute; left: 0px; top: 0px;" >';

   strMenuList = strMenuList+document.getElementById("RegionList").innerHTML;

   strMenuList = strMenuList+'</div></div>';

   document.getElementById("SiteList").innerHTML = strMenuList;

   var strGeneralStats = "<h4>";
   strGeneralStats = strGeneralStats+document.getElementById("NetStats").innerHTML+"</h4><br><p>";
   strGeneralStats = strGeneralStats+"Please select a region from the map opposite for more detailed traffic stats and to view opportunities in that region.";

   document.getElementById("MainContentArea").innerHTML = strGeneralStats;
   
   document.getElementById("MapSelectionArea").innerHTML = document.getElementById("MapSelectionAreaContent").innerHTML;

   
   
  }
}





function FillInSiteOverviewPage(strParams)
{

 BuildVoucherSection(strParams);
 BuildContentSection(strParams);
 BuildContextsSection(strParams, 0);
 BuildApproachesSection(strParams, 0);
 BuildEnquirySection(strParams);
 BuildLegalsSection(strParams);

}

function FillInButtonOverviewPage(strParams, intHasImage, strImageFileName, intMaxImWidth, intMaxImHeight)
{



 BuildVoucherSection(strParams);
 BuildEnquirySection(strParams);
 BuildLegalsSection(strParams);
 
 BuildButtonSection(strParams, intHasImage, strImageFileName, intMaxImWidth, intMaxImHeight);
 BuildeCard();
}


function FillInOffLineProductsPage(strParams)
{

 BuildVoucherSection(strParams);
 BuildOfflineEnquirySection(strParams);
 BuildOfflineContentSection(strParams);


}

function BuildOfflineContentSection(strParams)
{

   SiteAddOps_xmlHttp=GetXmlHttpObject();
     if (SiteAddOps_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APsiteofflineops.php";
   url = url+strParams;

     SiteAddOps_xmlHttp.onreadystatechange=SiteAddOps_stateChanged;
     SiteAddOps_xmlHttp.open("GET",url,true);
     SiteAddOps_xmlHttp.send(null);

   var strHtml = "Please wait.  Context details is now loading...<p>";
 document.getElementById("ContentDiv").innerHTML=strHtml;

}

function BuildOfflineEnquirySection(strParams)
{

 EnquiryForm_xmlHttp=GetXmlHttpObject();
     if (EnquiryForm_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APofflineenquirysection.php";
   url = url+strParams;

     EnquiryForm_xmlHttp.onreadystatechange=EnquiryForm_stateChanged;
     EnquiryForm_xmlHttp.open("GET",url,true);
     EnquiryForm_xmlHttp.send(null);

 var strHtml = "Please wait.  Enquiry submission section is now loading...<p>";
 document.getElementById("EnquireDiv").innerHTML=strHtml;
}

function EnquiryForm_stateChanged()
{
if (EnquiryForm_xmlHttp.readyState==4)
  {
    document.getElementById("EnquireDiv").innerHTML=EnquiryForm_xmlHttp.responseText
  }
}

function ActivateVoucher(strParams)
{
   Voucher_xmlHttp=GetXmlHttpObject();
     if (Voucher_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APprintvoucher.php";
   url = url+strParams;
   url = url+"&ACD="+document.getElementById("Tactivate").value;

     Voucher_xmlHttp.onreadystatechange=Voucher_stateChanged;
     Voucher_xmlHttp.open("GET",url,true);
     Voucher_xmlHttp.send(null);


    var strHtml = "Please wait while voucher activation is run...";
    document.getElementById("VoucherDiv").innerHTML=strHtml;
}

function BuildUserDetailsSection(strParams, strLogInMessage)
{

    UserDetails_xmlHttp=GetXmlHttpObject();
     if (UserDetails_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APuserdetailssection.php";
   url = url+strParams;
   url = url+"&LGMSG="+strLogInMessage;

     UserDetails_xmlHttp.onreadystatechange=UserDetails_stateChanged;
     UserDetails_xmlHttp.open("GET",url,true);
     UserDetails_xmlHttp.send(null);

}

function UserDetails_stateChanged()
{
if (UserDetails_xmlHttp.readyState==4)
  {

    document.getElementById("UserDetailsDiv").innerHTML=UserDetails_xmlHttp.responseText

  }
}

function BuildVoucherSection(strParams)
{

    Voucher_xmlHttp=GetXmlHttpObject();
     if (Voucher_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APprintvoucher.php";
   url = url+strParams;

     Voucher_xmlHttp.onreadystatechange=Voucher_stateChanged;
     Voucher_xmlHttp.open("GET",url,true);
     Voucher_xmlHttp.send(null);


    var strHtml = "";
    document.getElementById("VoucherDiv").innerHTML=strHtml;
}

function Voucher_stateChanged()
{
if (Voucher_xmlHttp.readyState==4)
  {

    document.getElementById("VoucherDiv").innerHTML=Voucher_xmlHttp.responseText


  }
}

function BuildRegionSection(strParams, intSelected)
{

   if(intSelected != '0')
    {
    intSelected = document.getElementById("cmbListRegionSites").value;
    }


   Regions_xmlHttp=GetXmlHttpObject();
     if (Regions_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

     var url=$strGloHostName+"/API/APregionsites.php";
   url = url+strParams;
   url = url+"&SID="+intSelected;

     Regions_xmlHttp.onreadystatechange=Regions_stateChanged;
     Regions_xmlHttp.open("GET",url,true);
     Regions_xmlHttp.send(null);

   var strHtml = "Please wait.  Region detail is now loading...<p>";
   if(intSelected != '0')
     {
      document.getElementById("RegionDetail").innerHTML=strHtml;
     }
     else
     {
     document.getElementById("SelSiteDiv").innerHTML=strHtml;
     }

}

function Regions_stateChanged()
{
if (Regions_xmlHttp.readyState==4)
  {


   document.getElementById("SelSiteDiv").innerHTML=Regions_xmlHttp.responseText

  }
}

function BuildRegionContentSection(strParams, intSiteID)
{

   SiteAddOps_xmlHttp=GetXmlHttpObject();
     if (SiteAddOps_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APregionaddops.php";
   url = url+strParams;
   url = url+"&SID="+intSiteID;


     SiteAddOps_xmlHttp.onreadystatechange=SiteAddOps_stateChanged;
     SiteAddOps_xmlHttp.open("GET",url,true);
     SiteAddOps_xmlHttp.send(null);

   var strHtml = "Please wait.  Context details is now loading...<p>";
 document.getElementById("ContentDiv").innerHTML=strHtml;

}


function BuildContentSection(strParams)
{

   SiteAddOps_xmlHttp=GetXmlHttpObject();
     if (SiteAddOps_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APsiteaddops.php";
   url = url+strParams;

     SiteAddOps_xmlHttp.onreadystatechange=SiteAddOps_stateChanged;
     SiteAddOps_xmlHttp.open("GET",url,true);
     SiteAddOps_xmlHttp.send(null);

   var strHtml = "Please wait.  Context details is now loading...<p>";
 document.getElementById("ContentDiv").innerHTML=strHtml;

}

function BuildeCard()
{



 var strImParams = "?T1="+document.getElementById("MainTitle").value;

 var intShadow = 0;
 if(document.getElementById("C1").checked)
 {
 intShadow = 1;
 }

 strImParams = strImParams + "&T1s="+intShadow;
 strImParams = strImParams + "&T2="+document.getElementById("SubTitle").value;
 var intShadow = 0;
 if(document.getElementById("C2").checked)
 {
 intShadow = 1;
 }
 strImParams = strImParams + "&T2s="+intShadow;
 strImParams = strImParams + "&BT1="+document.getElementById("T1").value;
 strImParams = strImParams + "&BT2="+document.getElementById("T2").value;
 strImParams = strImParams + "&BT3="+document.getElementById("T3").value;
 strImParams = strImParams + "&BT4="+document.getElementById("T4").value;
 
 
 strImParams = strImParams + "&MCT="+document.getElementById("MainContact").value;
 var intShadow = 0;
 if(document.getElementById("C3").checked)
 {
 intShadow = 1;
 }



 strImParams = strImParams + "&MCTs="+intShadow;
 strImParams = strImParams + "&SCT="+document.getElementById("CL2").value;

 strImParams = strImParams + "&OCT="+document.getElementById("CL3").value;

 strImParams = strImParams + "&TR="+document.getElementById("TR").value;
 strImParams = strImParams + "&TG="+document.getElementById("TG").value;
 strImParams = strImParams + "&TB="+document.getElementById("TB").value;
 

 
 strImParams = strImParams + "&BR="+document.getElementById("BR").value;
 strImParams = strImParams + "&BG="+document.getElementById("BG").value;
 strImParams = strImParams + "&BB="+document.getElementById("BB").value;

 strImParams = strImParams + "&IM="+document.getElementById("iHasImage").value;
 strImParams = strImParams + "&BFN="+document.getElementById("BackFileName").value;

 
 var intEffect = 0;
 if(document.getElementById("C6").checked)
 {
 intEffect = 1;
 }

 strImParams = strImParams + "&RSI="+intEffect;
 strImParams = strImParams + "&OX="+document.getElementById("iOffX").value;
 strImParams = strImParams + "&OY="+document.getElementById("iOffY").value;
 
 var html = '<img border="0" src="http://www.logo-advertiser.co.uk/APadbuilder.php'+strImParams+'">';
 
 document.getElementById("ecard").innerHTML=html;
 
 var html = '<img border="0" class="dragme" src="http://www.logo-advertiser.co.uk/APimprocess.php'+strImParams+'">';

 document.getElementById("imScratch").innerHTML=html;
 
 
}

function SetTextColour(r,g,b)
{
 document.getElementById("TR").value = r;
 document.getElementById("TG").value = g;
 document.getElementById("TB").value = b;
 
 BuildeCard()
}

function SetBackColour(r,g,b)
{
 document.getElementById("BR").value = r;
 document.getElementById("BG").value = g;
 document.getElementById("BB").value = b;
 
 BuildeCard()
}


function BuildButtonSection(strParams, intHasImage, strImageFileName, intMaxImWidth, intMaxImHeight)
{



   SiteAddOps_xmlHttp=GetXmlHttpObject();
     if (SiteAddOps_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }


    var strImParams = "?T1=Hello&T1s=1&T2=Again&T2s=1&BT1=line one here&BT2=Line two here&BT3=line is longer here.";



    var html = '<div align="left">';

    html = html+'<table border="0" cellspacing="1" width="600" height="200" >';
    html = html+'<tr>';
    html = html+'<td align="left" valign="top" width="200" height="200" bordercolor="#000080" bordercolorlight="#0000FF" bordercolordark="#0000FF" >';
    html = html+'<font color="#000000"><b>Your e-Card Design</b></font>';
    html = html+'<p>';
    html = html+'<img border="0" src="ResourceFiles/LAD_but_buildecard_flat.jpg" width="90" height="30" ';
    html = html+'onmouseover="ChangeImageSource(this, \'ResourceFiles/LAD_but_buildecard_up.jpg\')" ';
    html = html+'onmousedown="ChangeImageSource(this, \'ResourceFiles/LAD_but_buildecard_flat.jpg\')" ';
    html = html+'onmouseup="BuildeCard()" ';
    html = html+'onmouseout="ChangeImageSource(this, \'ResourceFiles/LAD_but_buildecard_flat.jpg\')" />';
    html = html+'<p>';
    html = html+'<div id="ecard">';
    html = html+'<img border="0" src="http://www.logo-advertiser.co.uk/APadbuilder.php'+strImParams+'">';
    html = html+'</div>';
    html = html+'<p><font color="#000000"><b>Image Scratch pad</b></font><p>';
    html = html+'<div id="imScratch">';
    html = html+'</div>';
    html = html+'<input type="hidden" name="iOffX" id="iOffX" value="0" />';
    html = html+'<input type="hidden" name="iOffY" id="iOffY" value="0" />';
    html = html+'<font color="#000000">Load Image</font><br>';
    html = html+'<form enctype="multipart/form-data" action="" method="POST">';
    html = html+'<input type="hidden" name="MAX_FILE_SIZE" value="222400" />';
    html = html+'<input type="file" name="file" type="file" id="file" size="0" /><p>';
    html = html+'<input type="submit" name="cmdupload" value="Load" /> <input type="submit" name="cmdclearim" value="Clear" />';
    html = html+'</form>';

    html = html+'<input type="hidden" name="iHasImage" id="iHasImage" value="'+intHasImage+'" />';
    html = html+'<input type="hidden" name="BackFileName" id="BackFileName" value="'+strImageFileName+'" />';

    html = html+'<font color="#000000"><b>Image Effects</b></font><br>';
    html = html+'<table border="0" cellspacing="1" width="100%" >'
    html = html+'<tr><td width="25%" >Re-size</td><td width="25%"><input type="checkbox" name="C6" id="C6" value="ON"></td>';
    html = html+'</tr>';

    html = html+'<tr><td width="25%" >Grayscale</td><td width="25%"><input type="checkbox" name="C7" value="ON"></td></tr>';
    html = html+'<tr><td width="25%" >Sketch effect</td><td width="25%"><input type="checkbox" name="C8" value="ON"></td></tr>';
    html = html+'<tr><td width="25%" >Colorise</td><td width="25%"><input type="checkbox" name="C9" value="ON"> (using background colour)</td></tr>';
    html = html+'<tr><td width="25%" >Emboss</td><td width="25%"><input type="checkbox" name="C10" value="ON"></td></tr>';
    html = html+'<tr><td width="25%" >Negative</td><td width="25%"><input type="checkbox" name="C11" value="ON"></td></tr>';
    html = html+'<tr><td width="25%" >Blur</td><td width="25%"><input type="checkbox" name="C7" value="ON"></td></tr>';
    html = html+'</table>';


    html = html+'<p>';
    html = html+'<font color="#000000"><b>Select e-Board for your card</b></font><p>';
    html = html+'</td>';
    html = html+'<td align="center" ></td>';
    html = html+'<td align="left" valign="top" ><font color="#000000"><h5>e-Card Builder</h5></font>';
    html = html+'To see your changes, click <font color="#000000"><b>BUILD CARD</b> opposite<p></font>';

    html = html+'<table border="0" cellspacing="1" width="100%" >';

    html = html+'<tr><td width="25%"><font color="#000000"><b>Text</b></font></td><td width="25%"></td></tr>';

    html = html+'<tr><td width="25%">Main title</td><td width="25%"><input type="text" value="This is your e-Card title" name="MainTitle" id="MainTitle" size="30"></td></tr>';
    html = html+'<tr><td width="25%" >Shadow</td><td width="25%"><input type="checkbox" name="C1" id="C1" value="ON" checked ></td>';
    html = html+'</tr>';
    
    html = html+'<tr><td width="25%">Sub-title</td><td width="25%"><input type="text" value="This is your e-Card sub-title" name="SubTitle" id="SubTitle" size="30"></td></tr>';
    html = html+'<tr><td width="25%" >Shadow</td><td width="25%"><input type="checkbox" name="C2" id="C2" value="ON"></td>';
    html = html+'</tr>';
    
    html = html+'<tr><td width="25%">Line 1</td><td width="25%"><input type="text" value="This is your first line of body content" name="T1" id="T1" size="40"></td></tr>';
    
    html = html+'<tr><td width="25%">Line 2</td><td width="25%"><input type="text" value="This is your second line of body content" name="T2" id="T2" size="40"></td></tr>';
    
    html = html+'<tr><td width="25%">Line 3</td><td width="25%"><input type="text" value="This is your third line of body content" name="T3" id="T3" size="40"></td></tr>';
    
    html = html+'<tr><td width="25%">Line 4</td><td width="25%"><input type="text" value="This is your fourth line of body content" name="T4" id="T4" size="40"></td></tr>';
    
    html = html+'<tr><td width="25%">Main contact</td><td width="25%"><input type="text" value="tel: 01234 567890" name="MainContact" id="MainContact" size="40"></td></tr>';
    html = html+'<tr><td width="25%" >Shadow</td><td width="25%"><input type="checkbox" name="C3" id="C3" value="ON" ></td>';
    html = html+'</tr>';
    
    html = html+'<tr><td width="25%">Sub-Contact</td><td width="25%"><input type="text" value="email: info@yourdomain.co.uk" name="CL2" id="CL2" size="40"></td></tr>';

    html = html+'<tr><td width="25%">Other Contact</td><td width="25%"><input type="text" value="web: www.yourdomain.co.uk" name="CL3" id="CL3" size="40"></td></tr>';

    html = html+'<tr><td width="25%"><font color="#000000"><b>Text Colour</b></font></td><td width="25%"></td></tr>';

   var StrChoices = '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Black_0-0-0.jpg" onmousedown="SetTextColour(0,0,0)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/White_255-255-255.jpg" onmousedown="SetTextColour(255,255,255)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Grey_167-167-167.jpg" onmousedown="SetTextColour(167,167,167)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Olive_103-104-59.jpg" onmousedown="SetTextColour(103,104,59)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Orange_224-64-0.jpg" onmousedown="SetTextColour(224,64,0)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Red_164-30-52.jpg" onmousedown="SetTextColour(164,30,52)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/DarkBlue_0-0-128.jpg" onmousedown="SetTextColour(0,0,128)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Purple_191-64-255.jpg" onmousedown="SetTextColour(191,64,255)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/DarkGreen_4-64-0.jpg" onmousedown="SetTextColour(4,64,0)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Brown_117-79-42.jpg" onmousedown="SetTextColour(117,79,42)" >';

    html = html+'<tr><td width="25%">Select</td><td width="25%">'+StrChoices+'</td></tr>';
    html = html+'<tr><td width="25%">Or enter</td><td width="25%">R<input type="text" value="0" name="TR" id="TR" size="2"> G<input type="text" value="0" name="TG" id="TG" size="2"> B<input type="text" value="128" name="TB" id="TB" size="2"> </td></tr>';

   StrChoices = '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Black_0-0-0.jpg" onmousedown="SetBackColour(0,0,0)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/White_255-255-255.jpg" onmousedown="SetBackColour(255,255,255)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Grey_167-167-167.jpg" onmousedown="SetBackColour(167,167,167)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Olive_103-104-59.jpg" onmousedown="SetBackColour(103,104,59)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Orange_224-64-0.jpg" onmousedown="SetBackColour(224,64,0)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Red_164-30-52.jpg" onmousedown="SetBackColour(164,30,52)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/DarkBlue_0-0-128.jpg" onmousedown="SetBackColour(0,0,128)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Purple_191-64-255.jpg" onmousedown="SetBackColour(191,64,255)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/DarkGreen_4-64-0.jpg" onmousedown="SetBackColour(4,64,0)" >';
   StrChoices = StrChoices + '<img border="0" src="http://www.logo-advertiser.co.uk/ColourChoices/Brown_117-79-42.jpg" onmousedown="SetBackColour(117,79,42)" >';



    html = html+'<tr><td width="25%"><font color="#000000"><b>Background</b></font></td><td width="25%"></td></tr>';
    html = html+'<tr><td width="25%">Select</td><td width="25%">'+StrChoices+'</td></tr>';
    html = html+'<tr><td width="25%">Or enter</td><td width="25%">R<input value="255" type="text" name="BR" id="BR" size="1"> G<input type="text" value="255" name="BG" id="BG" size="1"> B<input type="text" value="255" name="BB" id="BB" size="1"> </td></tr>';

    

    html = html+'</table>';
    html = html+'</td>';
    html = html+'</tr>';
    html = html+'</table>';



    html = html+'</div>';

 document.getElementById("ContentDiv").innerHTML=html;

}

function ButtonDetails_stateChanged()
{
if (ButtonDetails_xmlHttp.readyState==4)
  {

    document.getElementById("ContentDiv").innerHTML=SiteAddOps_xmlHttp.responseText


  }
}


function SiteAddOps_stateChanged()
{
if (SiteAddOps_xmlHttp.readyState==4)
  {

    document.getElementById("ContentDiv").innerHTML=SiteAddOps_xmlHttp.responseText


  }
}


function BuildContextsSection(strParams, intSelectedContext)
{

    if(intSelectedContext != '0')
    {
    intSelectedContext = document.getElementById("cmbListcontexts").value;
    }

     SiteContexts_xmlHttp=GetXmlHttpObject();
     if (SiteContexts_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

     var url=$strGloHostName+"/API/APsitecontexts.php";
     url = url+strParams;
     url = url+"&ACS="+intSelectedContext;

     SiteContexts_xmlHttp.onreadystatechange=SiteContexts_stateChanged;
     SiteContexts_xmlHttp.open("GET",url,true);
     SiteContexts_xmlHttp.send(null);

     var strHtml = "Please wait.  Context detail is now loading...<p>";
     if(intSelectedContext != '0')
     {
     document.getElementById("ContextDetail").innerHTML=strHtml;
     }
     else
     {
     document.getElementById("SelContextDiv").innerHTML=strHtml;
     }
}

function SiteContexts_stateChanged()
{
if (SiteContexts_xmlHttp.readyState==4)
  {
    document.getElementById("SelContextDiv").innerHTML=SiteContexts_xmlHttp.responseText
  }
}


function BuildApproachesSection(strParams, intSelected)
{

     if(intSelected != '0')
    {
    intSelected = document.getElementById("cmbListApproaches").value;
    }
     SiteApproaches_xmlHttp=GetXmlHttpObject();
     if (SiteApproaches_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APsiteapproaches.php";
   url = url+strParams;
   url = url+"&AAS="+intSelected;
   
     SiteApproaches_xmlHttp.onreadystatechange=SiteApproaches_stateChanged;
     SiteApproaches_xmlHttp.open("GET",url,true);
     SiteApproaches_xmlHttp.send(null);

 var strHtml = "Please wait.  Approach detail is now loading...<p>";
 if(intSelected != '0')
 {
 document.getElementById("ApproachDetail").innerHTML=strHtml;
 }
}

function SiteApproaches_stateChanged()
{
if (SiteApproaches_xmlHttp.readyState==4)
  {
    document.getElementById("SelOptionDiv").innerHTML=SiteApproaches_xmlHttp.responseText
  }
}

function SubmitEnquiry(strParams)
{



         EnquiryForm_xmlHttp=GetXmlHttpObject();
         if (EnquiryForm_xmlHttp==null)
         {
         alert ("We're sorry but your browser does not support AJAX.  The loGo_net commercials portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
         return;
         }

         var url=$strGloHostName+"/API/APsubmitenquiry.php";
         var params = strParams;
         params=params+"&EMSG="+document.getElementById("txtEnq").value;
         params=params+"&ENM="+document.getElementById("strEnqName").value;
         params=params+"&ECNTC="+document.getElementById("strEnqContact").value;

         EnquiryForm_xmlHttp.open("POST", url, true);

         //Send the proper header information along with the request
         EnquiryForm_xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
         EnquiryForm_xmlHttp.setRequestHeader("Content-length", params.length);
         EnquiryForm_xmlHttp.setRequestHeader("Connection", "close");

         EnquiryForm_xmlHttp.onreadystatechange=EnquiryForm_stateChanged;

         EnquiryForm_xmlHttp.send(params);
         
         var strHtml = '<font color="#0000FF">Please wait.  Your enquiry is now being submitted...</font><p>';
         document.getElementById("EnqIns").innerHTML=strHtml;
         

}

function BuildEnquirySection(strParams)
{

 EnquiryForm_xmlHttp=GetXmlHttpObject();
     if (EnquiryForm_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APenquirysection.php";
   url = url+strParams;

     EnquiryForm_xmlHttp.onreadystatechange=EnquiryForm_stateChanged;
     EnquiryForm_xmlHttp.open("GET",url,true);
     EnquiryForm_xmlHttp.send(null);

 var strHtml = "Please wait.  Enquiry submission section is now loading...<p>";
 document.getElementById("EnquireDiv").innerHTML=strHtml;
}

function EnquiryForm_stateChanged()
{
if (EnquiryForm_xmlHttp.readyState==4)
  {
    document.getElementById("EnquireDiv").innerHTML=EnquiryForm_xmlHttp.responseText
  }
}

function BuildLegalsSection(strParams)
{

 Legals_xmlHttp=GetXmlHttpObject();
     if (Legals_xmlHttp==null)
     {
     alert ("We're sorry but your browser does not support AJAX.  The loGo_net advertiser portal requires a browser which supports AJAX.  Please contact info@logo-net.co.uk for further information.");
     return;
     }

   var url=$strGloHostName+"/API/APsitelegals.php";
   url = url+strParams;

     Legals_xmlHttp.onreadystatechange=Legals_stateChanged;
     Legals_xmlHttp.open("GET",url,true);
     Legals_xmlHttp.send(null);

 var strHtml = "Please wait.  Links to Policy, Technical and Contract pages are now loading...<p>";
 document.getElementById("PolicyDiv").innerHTML=strHtml;
}

function Legals_stateChanged()
{
if (Legals_xmlHttp.readyState==4)
  {
    document.getElementById("PolicyDiv").innerHTML=Legals_xmlHttp.responseText
  }
}

function ChangeImageSource(elImage, strImAddress)
{

     elImage.src =strImAddress;
}


function Sorry()
{

     alert("Sorry.  That functionallity is not yet available.")
}

function LoadNewCreativeForm(strParams)
{
  var BuiltAction = "http://www.logo-advertiser.co.uk/APdashboard.php"+strParams;

      var htmlRet = "<b>Upload new creative.</b><p>";
      htmlRet = htmlRet+'<img border="0" src="ResourceFiles/50optionbutton_cancelGG.jpg" onmousedown="CancelNewCreativeForm(\'strParams\')" onmouseout="ChangeImageSource(this, \'ResourceFiles/50optionbutton_cancelGG.jpg\')" onmouseover="ChangeImageSource(this, \'ResourceFiles/50optionbutton_cancelH.jpg\')" ><p>';
      htmlRet = htmlRet+'<form enctype="multipart/form-data" action="'+BuiltAction+'" method="POST">';
      htmlRet = htmlRet+'Creative name<br>';
      htmlRet = htmlRet+'<input type="text" name="CreativeName" size="50"><br>';
      htmlRet = htmlRet+'Pixel width<br>';
      htmlRet = htmlRet+'<input type="text" name="Width" size="10"><br>';
      htmlRet = htmlRet+'Pixel Height<br>';
      htmlRet = htmlRet+'<input type="text" name="Height" size="10"><br>';
      htmlRet = htmlRet+'<input type="hidden" name="MAX_FILE_SIZE" value="222400" />';
      htmlRet = htmlRet+'Select creative to upload (file size may not exceed 200kb and must be either a jpg, gif, bmp, png or swf (flash) file):<br><input type="file" name="file" type="file" id="file" size="50" /><p>';
      htmlRet = htmlRet+'<input type="submit" name="cmdupload" value="Upload Creative" />';
      htmlRet = htmlRet+'</form>';

      document.getElementById("NewCreativeForm").innerHTML=htmlRet;
}


function CancelNewCreativeForm(strParams)
{
      var htmlRet = '<img border="0" src="ResourceFiles/50optionbutton_loadnewG.jpg" onmousedown="LoadNewCreativeForm(\'strParams\')" onmouseout="ChangeImageSource(this, \'ResourceFiles/50optionbutton_loadnewG.jpg\')" onmouseover="ChangeImageSource(this, \'ResourceFiles/50optionbutton_loadnewH.jpg\')" >';
      document.getElementById("NewCreativeForm").innerHTML=htmlRet;
}



function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

