﻿// JScript File
//Remove the accept check box as per v2.3
//        function ValidateAgreeChk()
//        {
//            document.getElementById('Error').style.display = 'none';
//        
//            //alert(document.getElementById('<%= txtClaimNumber.ClientID %>'));
//            
//            if(document.getElementById('<%= txtClaimNumber.ClientID %>') == null)
//            {
//                if(document.getElementById('<%= chkAgree.ClientID %>').checked)
//                {
//                    return true;
//                }
//                else
//                {
//                    document.getElementById('ValidationMsg').innerText = "Please accept the Examiner's terms and policies in order to confirm an event.";             
//                    //alert("Please accept the Examiner's terms and policies in order to confirm an event.");
//                    return false;
//                }
//            }
//            else
//            {
//                if(document.getElementById('<%= txtClaimNumber.ClientID %>').value != '')
//                {
//                    if(document.getElementById('<%= chkAgree.ClientID %>').checked)
//                    {
//                        return true;
//                    }
//                    else
//                    {
//                        document.getElementById('ValidationMsg').innerText = "Please accept the Examiner's terms and policies in order to confirm an event.";             
//                        //alert("Please accept the Examiner's terms and policies in order to confirm an event.");
//                        return false;
//                    }
//                }
//                else
//                {
//                    document.getElementById('ValidationMsg').innerText = "Please enter the Claim Number.";             
//                    //alert("Please enter the Claim Number.");
//                    return false;
//                }
//            }
//        }
//     
function ClearTextBoxOnButtonClick(txtTextBox)
{
    var txtTextBox = document.getElementById(txtTextBox);
    if(txtTextBox != null)
    {
        txtTextBox.value="";
    }
}
function changeClass(txtTextBox)
{
    var txtTextBox = document.getElementById(txtTextBox);
    alert(txtTextBox);
    if(txtTextBox != null)
    {
        txtTextBox.className="arial11n000000";
    }
}

function Check(lstNetworks, ddlDomainType, lblLstValidator)
{
    var lstNetworks = document.getElementById(lstNetworks);
    var ddlDomainType = document.getElementById(ddlDomainType);
    var lblLstValidator = document.getElementById(lblLstValidator);
   //alert(lblLstValidator.value);
    
    if(lstNetworks != null)
    {        
        if(ddlDomainType.value == 2)
        {
            if(lstNetworks.selectedIndex == -1)
            {
                lstNetworks.focus();
                lblLstValidator.innerHTML="Please select atleast one network name.";
                return false; 
            }
        }
    }
    //lblLstValidator.value="";
    return true;
}



function ReloadPage()
{
    window.location=location.href;
}


function ControlVisibilityOnDropdownChange(ddlDomainType , ddlNetworkName, lblNetworkName, spnNetworkStar, rfvDdlNetworkName)
{
    var ddlDomainType = document.getElementById(ddlDomainType);
    var ddlNetworkName = document.getElementById(ddlNetworkName);
    var lblNetworkName = document.getElementById(lblNetworkName);
    var spnNetworkStar = document.getElementById(spnNetworkStar);
    var rfvDdlNetworkName = document.getElementById(rfvDdlNetworkName);

   if(rfvDdlNetworkName!=null)
   {
    if(ddlDomainType.value == "1")//if single domain
    {
     
        ddlNetworkName.selectedIndex = 0;
        ddlNetworkName.style.display = 'none';
        lblNetworkName.style.display = 'none';     
        spnNetworkStar.style.display = 'none';
        rfvDdlNetworkName.disabled = true; 
        rfvDdlNetworkName.enabled = false; 
        rfvDdlNetworkName.style.display = 'none'; 
    }
    else //2 if network domain
    {
        ddlNetworkName.style.display = '';
        lblNetworkName.style.display = ''; 
        spnNetworkStar.style.display = ''; 
        rfvDdlNetworkName.disabled = false; 
        rfvDdlNetworkName.enabled = true; 
        rfvDdlNetworkName.style.display = ''; 
    }  
       
}
return false;
}









//alert("typeof window.addEventListener: " + typeof window.addEventListener);
//alert("typeof window.attachEvent: " + typeof window.attachEvent);
if (typeof window.addEventListener != "undefined" )
{
    var a= window.addEventListener( "load", loadclass, false );
}
else if ( typeof window.attachEvent != "undefined" ) 
{
    var a=  window.attachEvent("onload", function(){loadclass()}); 
}

function loadclass()
{ 
      
    var aTotalVisits = document.getElementById("aTotalVisits");
   var aBrowserOS = document.getElementById("aBrowserOS");
   var aPagePopularity = document.getElementById("aPagePopularity");
  var aVisitorsCount = document.getElementById("aVisitorsCount");
    var aReferrals = document.getElementById("aReferrals");
    var aVisitsByCountry = document.getElementById("aVisitsByCountry");
 var aSearchEngines = document.getElementById("aSearchEngines");
//    var aMyAccount = document.getElementById("aMyAccount");
        //alert(aTotalVisits);
    if(aTotalVisits != null)
    {
        var cUrl = location.href;
        if(cUrl.indexOf("Common/Default.aspx") != -1)//total visit/home page
        {
            aTotalVisits.className="arial12b018DBB";
            aBrowserOS.className="arial12b000000_a";
            aPagePopularity.className="arial12b000000_a";
            aVisitorsCount.className="arial12b000000_a";
            aReferrals.className="arial12b000000_a";
            aVisitsByCountry.className="arial12b000000_a";
            aSearchEngines.className="arial12b000000_a";
            aMyAccount.className="arial12b000000_a";
        }
   
       else if(cUrl.indexOf("Reports/loudBrowserOSDtls.aspx") != -1)//browser os
       {
            aTotalVisits.className="arial12b000000_a";
            aBrowserOS.className="arial12b018DBB";
            aPagePopularity.className="arial12b000000_a";
            aVisitorsCount.className="arial12b000000_a";
            aReferrals.className="arial12b000000_a";
            aVisitsByCountry.className="arial12b000000_a";
            aSearchEngines.className="arial12b000000_a";
            aMyAccount.className="arial12b000000_a";
        }
  
        
        else if(cUrl.indexOf("Reports/loudPagePopularityIPAddressDetails.aspx") != -1 || cUrl.indexOf("Reports/LoudOfiice_Page_Popularity.aspx") != -1 || cUrl.indexOf("Reports/loudPagePopularityDetails.aspx") != -1)//page popularity
        {
            aTotalVisits.className="arial12b000000_a";
            aBrowserOS.className="arial12b000000_a";
            aPagePopularity.className="arial12b018DBB";
            aVisitorsCount.className="arial12b000000_a";
            aReferrals.className="arial12b000000_a";
            aVisitsByCountry.className="arial12b000000_a";
            aSearchEngines.className="arial12b000000_a";
            aMyAccount.className="arial12b000000_a";
        }
        
      else  if(cUrl.indexOf("Reports/loudUniqueVisitors") != -1 || cUrl.indexOf("Reports/Loudoffice_Visitor_count_hourly_details") != -1 || cUrl.indexOf("Reports/loudoffice_unique_visitors.aspx") != -1 || cUrl.indexOf("Reports/Loud_IpHitDetail.aspx") != -1)//visitorcount
       {
            aTotalVisits.className="arial12b000000_a";
            aBrowserOS.className="arial12b000000_a";
            aPagePopularity.className="arial12b000000_a";
            aVisitorsCount.className="arial12b018DBB";
            aReferrals.className="arial12b000000_a";
            aVisitsByCountry.className="arial12b000000_a";
            aSearchEngines.className="arial12b000000_a";
            aMyAccount.className="arial12b000000_a";
        }
        
       else  if(cUrl.indexOf("Reports/loudoffice_referrers.aspx") != -1 || cUrl.indexOf("Reports/loudoffice_custom_referral_tracking.aspx") != -1 || cUrl.indexOf("Reports/LoudOffice_Most_Popular_Referrers.aspx") != -1)//refferals
        {
            aTotalVisits.className="arial12b000000_a";
            aBrowserOS.className="arial12b000000_a";
            aPagePopularity.className="arial12b000000_a";
            aVisitorsCount.className="arial12b000000_a";
            aReferrals.className="arial12b018DBB";
            aVisitsByCountry.className="arial12b000000_a";
            aSearchEngines.className="arial12b000000_a";
            aMyAccount.className="arial12b000000_a";
        }
        
      else  if(cUrl.indexOf("Reports/loudoffice_visits_bycountry.aspx") != -1)//visit by country
       {
            aTotalVisits.className="arial12b000000_a";
            aBrowserOS.className="arial12b000000_a";
            aPagePopularity.className="arial12b000000_a";
            aVisitorsCount.className="arial12b000000_a";
            aReferrals.className="arial12b000000_a";
            aVisitsByCountry.className="arial12b018DBB";
            aSearchEngines.className="arial12b000000_a";
            aMyAccount.className="arial12b000000_a";
        }
        
       else  if(cUrl.indexOf("Reports/loudoffice_searchengine") != -1 || cUrl.indexOf("Reports/loudSearchEngine") != -1)//search engine
        {
            aTotalVisits.className="arial12b000000_a";
            aBrowserOS.className="arial12b000000_a";
            aPagePopularity.className="arial12b000000_a";
            aVisitorsCount.className="arial12b000000_a";
            aReferrals.className="arial12b000000_a";
            aVisitsByCountry.className="arial12b000000_a";
            aSearchEngines.className="arial12b018DBB";
            aMyAccount.className="arial12b000000_a";
        }
        
       else if(cUrl.indexOf("Common/loudManage") != -1)//my account
       {
            aTotalVisits.className="arial12b000000_a";
            aBrowserOS.className="arial12b000000_a";
            aPagePopularity.className="arial12b000000_a";
            aVisitorsCount.className="arial12b000000_a";
            aReferrals.className="arial12b000000_a";
            aVisitsByCountry.className="arial12b000000_a";
            aSearchEngines.className="arial12b000000_a";
            aMyAccount.className="arial12b018DBB";
        }
        else
        {
            aTotalVisits.className="arial12b000000_a";
            aBrowserOS.className="arial12b000000_a";
            aPagePopularity.className="arial12b000000_a";
            aVisitorsCount.className="arial12b000000_a";
            aReferrals.className="arial12b000000_a";
            aVisitsByCountry.className="arial12b000000_a";
            aSearchEngines.className="arial12b000000_a";
            aMyAccount.className="arial12b018DBB";
        }
        
    }
}

    function SelectAllCheckboxes(spanChk)
    {
        // Added as ASPX uses SPAN for checkbox
        var oItem = spanChk.children;        
        var theBox= (spanChk.type=="checkbox") ? spanChk: spanChk.children.item[0];
        xState=theBox.checked;
        elm=theBox.form.elements;
        for(i=0;i<elm.length;i++)
        {
            if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
            {
                //elm[i].click();
                if(elm[i].checked!=xState)
                elm[i].click();
                //elm[i].checked=xState;
            }
        }
    }
    
//function ManageNetworkDropdown(sourceControl,TargetControl)
//{
//    sourceControl = document.getElementById(sourceControl);
//    TargetControl = document.getElementById(TargetControl);
//    if(sourceControl.value==1)
//    {
//        TargetControl.style.display="None";
//    }
//    //alert(sourceControl.value);
//    //alert(TargetControl);
//}
function ShowLoaderDiv(loaderDiv, ctrlIdentifier)
{
loaderDiv = document.getElementById(loaderDiv);
switch(ctrlIdentifier.toLowerCase())
{
    case "quicksearch":
        if (loaderDiv.toLowerCase().indexOf("defaultpicturecontent") != -1)
        {
            loaderDiv.style.top= "100px";
            loaderDiv.style.left= "300px";
        }
        else
        {
           loaderDiv.style.top= "203px";
           loaderDiv.style.left= "370px";
        }
        break;
        
    case "index":
        loaderDiv.style.top= "100px";
        loaderDiv.style.left= "300px";
        break;
        
    case "advancesearch":
        loaderDiv.style.top= "80px";
        loaderDiv.style.left= "-250px";
        break;  
        
    case "searchresult":
        loaderDiv.style.top= "250px";
       loaderDiv.style.left= "350px";
        break;  
        
    case "addprice":
        loaderDiv.style.top= "300px";
        loaderDiv.style.left= "350px";
        break;  
        
    case "updatecalendar":
        loaderDiv.style.top= "43px";
        loaderDiv.style.left= "250px";
        break;  
    case "uploadpicturetop":
        loaderDiv.style.top= "250px";
        loaderDiv.style.left= "350px";
        break;      
    case "uploadpicturebottom":
        loaderDiv.style.top= "450px";
       loaderDiv.style.left= "350px";
        break;  

    default:
        loaderDiv.style.top= "70px";
        loaderDiv.style.left= "250px";
}


loaderDiv.style.display = "inline";
window.setTimeout('',"2000"); 
}

function ShowAlert()
{
    alert('Hi');
}
///////////////////////////////////////////////////////////////////////////
//this function will populate the "end date" box following the "start date" box
///////////////////////////////////////////////////////////////////////////
function FillEndDateBox(datea, id)
{
    alert(Source);
    var Source = id;
    //var Target = id.split("DPVPContact_CalendarStartDate")
    alert(Source);
    var Source = document.getElementById(Source);
    alert(document.getElementById(Source).value);
//    var BaseAddressString  = Target[0]
//    Target[0] = BaseAddressString + "DPVPContact_CalendarEndDate"
//    ctrl = document.getElementById(Target[0]);
//    return;
}

function ShowLargerImage(url,pictureName)
{
    var w = window.open(url, "WindowName", "height=290px, width=370, menubar=0, statusbar=0, scrollbars=0, resizable=0, top=200, left=300");
    w.focus();
}
function ShowPreview(url,iWidth)
{
    var w = window.open(url, "Name", "height=600px, width=" + iWidth + ", menubar=0, statusbar=0, scrollbars=1, resizable=0, top=10, left=100");
    w.focus();
}
function returnFalse(vars)
{
    //return false;
    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(vars, "", true, "", "", false, false));
}

function ShowAboutPaypal()
{
    window.open("https://www.paypal.com/cgi-bin/webscr?cmd=xpt/popup/OLCWhatIsPayPal-outside", "Name", "menubar=0, toolbar=0, resizable=0, height=450, width=750");
}

function ShowTerms(path)
{
    var w = window.open(path, "Name", "menubar=0, toolbar=0, scrollbars=1, resizable=0, height=450, width=750");
     w.focus();
}

function ShowSusbSetting(path)
{
    var w = window.open(path, "Name", "menubar=0, toolbar=0, scrollbars=0, resizable=0, height=280, width=590");
     w.focus();
}


function ShowLoader(LoadingText, loaderIframe, loaderDiv, SourcePath, ctrlIdentifier)
{		

if(LoadingText !='')
{
    var vars = document.getElementById(loaderIframe);
    if (vars != null)
    {
	    vars.contentWindow.ShowText(LoadingText);
	}
}		

switch(ctrlIdentifier.toLowerCase())
{
    case "quicksearch":
        if (loaderDiv.toLowerCase().indexOf("defaultpicturecontent") != -1)
        {
            document.getElementById(loaderDiv).style.top= "100px";
            document.getElementById(loaderDiv).style.left= "300px";
        }
        else
        {
             document.getElementById(loaderDiv).style.top= "203px";
            document.getElementById(loaderDiv).style.left= "370px";
        }
        break;
        
    case "index":
        document.getElementById(loaderDiv).style.top= "50px";
        document.getElementById(loaderDiv).style.left= "250px";
        break;
        
    case "advancesearch":
        document.getElementById(loaderDiv).style.top= "80px";
        document.getElementById(loaderDiv).style.left= "-250px";
        break;  
        
    case "searchresult":
        document.getElementById(loaderDiv).style.top= "250px";
        document.getElementById(loaderDiv).style.left= "350px";
        break;  
        
    case "addprice":
        document.getElementById(loaderDiv).style.top= "300px";
        document.getElementById(loaderDiv).style.left= "350px";
        break;  
        
    case "updatecalendar":
        document.getElementById(loaderDiv).style.top= "43px";
        document.getElementById(loaderDiv).style.left= "250px";
        break;  
    case "uploadpicturetop":
        document.getElementById(loaderDiv).style.top= "250px";
        document.getElementById(loaderDiv).style.left= "350px";
        break;      
    case "uploadpicturebottom":
        document.getElementById(loaderDiv).style.top= "450px";
        document.getElementById(loaderDiv).style.left= "350px";
        break;  

    default:
        document.getElementById(loaderDiv).style.top= "70px";
        document.getElementById(loaderDiv).style.left= "250px";
}


document.getElementById(loaderDiv).style.display = "inline";
window.setTimeout('',"2000"); 
}




function HideLoader(loaderDiv)
{
//alert(loaderDiv)
    if(document.getElementById(loaderDiv) != null)
    {
	    document.getElementById(loaderDiv).style.display = "none";				
	}
}

function CentralAlignSlidingWindow800(divName)
{
	iHeight = parseInt(divName.style.height,10);
	iWidth= parseInt(divName.style.width,10);
	var sHeight,sWidth;
	if(iHeight < window.document.body.scrollHeight)
	{							
	    if (document.documentElement && document.documentElement.scrollTop)
		{
	        sHeight =((window.document.documentElement.clientHeight /2  )-200) - (iHeight/2);
	    }
        else if (document.body)
        {
	        sHeight =((window.document.body.clientHeight /2  ) - 200) - (iHeight/2);
	    }
        else
        {
	        //[Netscape stuff]
	    }
	}
	else
	{
		sHeight =(window.document.body.clientHeight /2  ) - (iHeight/2);
	}
	
	
	if(parseInt(iWidth, 10) < 800)
	{	
		sWidth = (800 /2  ) - (iWidth /2); 
	}
	//hard coded temporarity
    //sHeight = 200;
    //	sWidth=300;
	divName.style.left = sWidth;	
	divName.style.top = sHeight;
	divName.style.zIndex = 1111899;		
}

function SetProgressBarVisibilityOff(vars1, vars2)
{
    //vars = document.getElementById(vars);
    //vars.style.visibility="visible";
    MM_showHideLayers(vars1,'','hide');  
    MM_showHideLayers(vars2,'','hide');  
    
    //MM_showHideLayers('DivMainIndex','','show');  
}

function SetProgressBarVisibilityOn(vars1,vars2)
{
    //vars.style.visibility="visible";
    MM_showHideLayers(vars1,'','show');
    MM_showHideLayers(vars2,'','show');
    //MM_showHideLayers('DivMainIndex','','hide');
}

function ControlVisibilityOnDropdownClick(ctrlSourceDropdown,ctrlTargetControl,txtAMember_AgencyName)
{
    if(document.getElementById(ctrlSourceDropdown).value.toLowerCase() == "agency")
    {
        document.getElementById(ctrlTargetControl).style.display = "";
        if (document.getElementById(txtAMember_AgencyName).value=='$#$#$#$')
        {
            document.getElementById(txtAMember_AgencyName).value= '';
        }
    }
    else
    {
        document.getElementById(ctrlTargetControl).style.display = "none";
        document.getElementById(txtAMember_AgencyName).value= '$#$#$#$';
    }
}

function AgencyDivControllerCaller(ctrlSourceDropdown,ctrlTargetControl,txtAMember_AgencyName)
{
    ControlVisibilityOnDropdownClick(ctrlSourceDropdown,ctrlTargetControl,txtAMember_AgencyName);
}

function DepositValueRadio(chkP2_Deposit, txtP2_DepositValue, txtP2_DepositPercent)
{
    document.getElementById(chkP2_Deposit).checked=true;
    document.getElementById(txtP2_DepositPercent).value='';
    document.getElementById(txtP2_DepositValue).focus();
}



function DepositPercentRadio(chkP2_Deposit, txtP2_DepositValue, txtP2_DepositPercent)
{
    document.getElementById(chkP2_Deposit).checked=true;
    document.getElementById(txtP2_DepositValue).value='';
    document.getElementById(txtP2_DepositPercent).focus();
}

function CheckCostImagesInEditMode(txtP2_LinenPrice, rdbP2_LinenNotIncl, txtP2_CleaningPrice, rdbP2_CleaningNotIncl, txtP2_PetsPrice, rdbP2_PetsNotIncl, txtP2_DepositValue, rdbP2_DepositCurrency,  txtP2_DepositPercent, rdbP2_DepositPercentage, chkP2_Deposit)
{
    var ctrlInc;
    if(document.getElementById(txtP2_LinenPrice).value != '' && document.getElementById(txtP2_LinenPrice).value > 0)
    {
        document.getElementById(rdbP2_LinenNotIncl).checked = true;
    }
    
    if(document.getElementById(txtP2_CleaningPrice).value != '' && document.getElementById(txtP2_CleaningPrice).value > 0)
    {
        document.getElementById(rdbP2_CleaningNotIncl).checked = true;
    }
  
    
    if(document.getElementById(txtP2_PetsPrice).value != '' && document.getElementById(txtP2_PetsPrice).value > 0)
    {
        document.getElementById(rdbP2_PetsNotIncl).checked = true;
    }
  
    
    if(document.getElementById(txtP2_DepositValue).value != '' && document.getElementById(txtP2_DepositValue).value > 0)
    {
        document.getElementById(rdbP2_DepositCurrency).checked = true;
        document.getElementById(chkP2_Deposit).checked = true;
    }

    
    if(document.getElementById(txtP2_DepositPercent).value != '' && document.getElementById(txtP2_DepositPercent).value > 0)
    {
        document.getElementById(rdbP2_DepositPercentage).checked = true;
        document.getElementById(chkP2_Deposit).checked = true;
        
    }
  

}

function ConfirmDelete(msg)
{
	if(confirm(msg) == true)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function SetFocusOnControl(ctrl)
{
    ctrl.focus();
}

///////////////////////////////////////////////////////////////////////////
//this function will Control the visibility of description text boxes in edit mode on create property step 1
///////////////////////////////////////////////////////////////////////////
function ManageDescriptionBoxesInEditMode(descLanguage, txtDescEnglish, txtDescFrench, txtDescDeutsch, txtP1_PropertyName, isOnLoad)
{
    /* ========================================================================== 
     Method will set the visibility of the description boxes in edit mode, also will set the focus
     If value of 'isOnload' is 0, focust will be set on the respective description text box
     Otherwise focus will be set by default on the text box for property Name
     If Method is being called from window.onload, the value of isOnload will come '1',
     While on being called through the click of description buttons, isOnload will be '0'
     ===========================================================================*/
    ManageDescriptionTextBoxes(descLanguage, txtDescEnglish, txtP1_PropertyName, isOnLoad);
     /*=========================================================================*/
    
    txtDescEnglish = document.getElementById(txtDescEnglish);
    txtDescFrench = document.getElementById(txtDescFrench);
    txtDescDeutsch = document.getElementById(txtDescDeutsch);
    
     /* ==========================================================================
        Method will count the number of characters which are entered int the description text boxes
        and will display the number of remaining characters that the user can enter more. the max limit is 500. 
        =========================================================================*/
       CountCharacters(descLanguage, txtDescEnglish, txtDescFrench, txtDescDeutsch);
     /*===========================================================================*/
       
    if(txtDescEnglish != null)
    {
        document.getElementById('divDescEnglish').style.display = ""
        document.getElementById('divDescFrench').style.display = "none"
        document.getElementById('divDescDeutsch').style.display = "none"
        document.getElementById('txtP1_StillEnglish').value = 500 - txtDescEnglish.value.length
        document.getElementById('txtP1_StillFrench').value = 500 - txtDescFrench.value.length
        document.getElementById('txtP1_StillDeutsch').value = 500 - txtDescDeutsch.value.length
        document.getElementById('divStillEnglish').style.display =""
        document.getElementById('divStillFrench').style.display ="none"
        document.getElementById('divStillDeutsch').style.display ="none"
    }
}



///////////////////////////////////////////////////////////////////////////
//enable/disable textbox on a checkbox or radiobutton click
///////////////////////////////////////////////////////////////////////////
function EnableDisableSingleTextBox(Source,ctrlTarget)
{
    if(Source.checked)
    {
        ctrlTarget.disabled = false;
    }
    else
    {
        ctrlTarget.disabled = true;
        ctrlTarget.value="";
    }
}

///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////



function Test()
{
    alert("This is Test");
}



///////////////////////////////////////////////////////////////////////////
//Manage visibility of Description boxes
///////////////////////////////////////////////////////////////////////////
function ManageDescriptionTextBoxes(descLanguage, ctrl,  txtP1_PropertyName, isOnLoad)
{   
if(ctrl != null)
{
            ctrl = document.getElementById(ctrl)
            descLanguage = descLanguage.toLowerCase();
            var ctrlDivDescEnglish = document.getElementById('divDescEnglish')
            var ctrlDivDescFrench = document.getElementById('divDescFrench')
            var ctrlDivDescDeutsch = document.getElementById('divDescDeutsch')
   
            var ctrlDivStillEnglish = document.getElementById('divStillEnglish')
            var ctrlDivStillFrench = document.getElementById('divStillFrench')
            var ctrlDivStillDeutsch = document.getElementById('divStillDeutsch')
            
            if(ctrlDivDescEnglish != null)
            {
                switch(descLanguage)
                {
                    case "english":
                    
                        ctrlDivDescEnglish.style.display = ""
                        ctrlDivDescFrench.style.display = "none"
                        ctrlDivDescDeutsch.style.display = "none"
                        
                        ctrlDivStillEnglish.style.display =""
                        ctrlDivStillFrench.style.display ="none"
                        ctrlDivStillDeutsch.style.display ="none"
                        break
                    case "french":
          
                        ctrlDivDescEnglish.style.display = "none"
                        ctrlDivDescFrench.style.display = ""
                        ctrlDivDescDeutsch.style.display = "none"
                        
                        ctrlDivStillEnglish.style.display ="none"
                        ctrlDivStillFrench.style.display =""
                        ctrlDivStillDeutsch.style.display ="none"
                        break
                    case "deutsch":
                          ctrlDivDescEnglish.style.display = "none"
                        ctrlDivDescFrench.style.display = "none"
                        ctrlDivDescDeutsch.style.display = ""
                        
                        ctrlDivStillEnglish.style.display ="none"
                        ctrlDivStillFrench.style.display ="none"
                        ctrlDivStillDeutsch.style.display =""
                        break
                }
           
                    if(isOnLoad==1)
                    {
                        ctrl = document.getElementById(txtP1_PropertyName)
                    }
                    ctrl.focus();
            }
}
    return false;
}
///////////////////////////////////////////////////////////////////////////
//Common function to check radio/checkbox on focus at textbox
function CheckSingleOptionOnFocus(ctrlToBeChecked)
{
    if(document.getElementById(ctrlToBeChecked) != null)
    {
        document.getElementById(ctrlToBeChecked).checked = true;
    }
}


//Common function to Uncheck radio/checkbox on focus at textbox
function UnCheckSingleOptionOnBlur(ctrlToBeChecked, ctrlValueControl)
{
    if (document.getElementById(ctrlValueControl).value == '')
    {
        document.getElementById(ctrlToBeChecked).checked = false;
    }
}

//deposit value insert
function DepositValue(ddlDepositCurrency, txtDepositPercent, chkP2_Deposit)
{
    document.getElementById(ddlDepositCurrency).checked=true;
    document.getElementById(chkP2_Deposit).checked=true;
    document.getElementById(txtDepositPercent).value='';
}

//deposit percent insert
function DepositPercent(ddlDepositPercentage, txtDepositValue, chkP2_Deposit)
{
    document.getElementById(ddlDepositPercentage).checked=true;
     document.getElementById(chkP2_Deposit).checked=true;
    document.getElementById(txtDepositValue).value='';
}

//deposit percent insert
function DoTextBoxBlankOnCheck(TextBoxToDoBlank,Culture)
{
    var oTextBoxToDoBlank = document.getElementById(TextBoxToDoBlank);
    
    if(oTextBoxToDoBlank != null)
    {
        if(Culture.toLowerCase().indexOf('en') != -1 )
        {
            oTextBoxToDoBlank.value='0.00';
        }
        else 
        {
            oTextBoxToDoBlank.value='0,00';
        }
        
    }
     
}

///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////



function ManageMoreCheckBoxes(txtP1_KitchenMore1, txtP1_LivingRoomMore1, txtP1_OutsideMore1, txtP1_LocalActivitiesMore1, chkP1_KitchenMore1, chkP1_LivingRoomMore1, chkP1_OutsideMore1, chkP1_LocalActivitiesMore1)
{

    txtP1_KitchenMore1 = document.getElementById(txtP1_KitchenMore1);
    txtP1_LivingRoomMore1 = document.getElementById(txtP1_LivingRoomMore1);
    txtP1_OutsideMore1 = document.getElementById(txtP1_OutsideMore1);
    txtP1_LocalActivitiesMore1 = document.getElementById(txtP1_LocalActivitiesMore1);
    chkP1_KitchenMore1 = document.getElementById(chkP1_KitchenMore1);
    chkP1_LivingRoomMore1 = document.getElementById(chkP1_LivingRoomMore1);
    chkP1_OutsideMore1 = document.getElementById(chkP1_OutsideMore1);
    chkP1_LocalActivitiesMore1 = document.getElementById(chkP1_LocalActivitiesMore1);
    if (txtP1_KitchenMore1!=null)
    {
        if(txtP1_KitchenMore1.value != '')
        {
            chkP1_KitchenMore1.checked=true;
        }
    }
}

function fnBeforePaste() {
     event.returnValue = false;
}

// The second parameter set in getData causes sNewString 
// to be pasted into the text input. Passing no second
// parameter causes the SPAN text to be pasted instead.
	
function fnPaste(source, txtDescEnglish, txtDescFrench, txtDescDeutsch)
{
      event.returnValue = false;
//    oTarget.value = ;


source = source.toLowerCase();
var lenEnglish = txtDescEnglish.value.length;
var lenFrench = txtDescFrench.value.length ;
var lenDeutsch = txtDescDeutsch.value.length ;
var ctrlEnglish = document.getElementById('divStillEnglish');
var ctrlFrench = document.getElementById('divStillFrench');
var ctrlDeutsch = document.getElementById('divStillDeutsch');
var PasteToText = window.clipboardData.getData("Text");

    switch(source)
    {
        case "english":
            ctrlEnglish.style.display ="";
            ctrlFrench.style.display ="none";
            ctrlDeutsch.style.display ="none";

            if (500 > PasteToText.length + lenEnglish)
            {

                txtDescEnglish.value = txtDescEnglish.value + PasteToText;
                lenEnglish = lenEnglish + PasteToText.length;
            }
            if (lenEnglish>5)
            {
                txtDescEnglish.value = txtDescEnglish.value.substring(0, 500);
            } 
            document.getElementById('txtP1_StillEnglish').value=  500 -lenEnglish ;
            break;
        case "french":

            ctrlEnglish.style.display ="none";
            ctrlFrench.style.display ="";
            ctrlDeutsch.style.display ="none";
            if (lenFrench > PasteToText.length)
            {
                txtDescFrench.value = txtDescFrench.value + PasteToText;
                lenFrench = lenFrench - PasteToText.length;
            }
            if (lenFrench>5)
            {
               txtDescFrench.value = txtDescFrench.value.substring(0, 500);
            }        
            document.getElementById('txtP1_StillFrench').value=  500 - lenFrench;
            break;
        case "deutsch":
            ctrlEnglish.style.display ="none";
            ctrlFrench.style.display ="none";
            ctrlDeutsch.style.display ="";
            if (lenDeutsch > PasteToText.length)
            {
                txtDescDeutsch.value = txtDescDeutsch.value + PasteToText;
                lenDeutsch = lenDeutsch - PasteToText.length;
            }
            if (lenDeutsch>5)
            {
               txtDescDeutsch.value = txtDescDeutsch.value.substring(0, 500);
            }        
            document.getElementById('txtP1_StillDeutsch').value=  500 - lenDeutsch;
            break;
    }
   
   
}

//////////////////////////////////////////////////////////////////////////
function ListValidate(source, args)
{       
    args.IsValid = false;
  //  var ddlDomainType = document.getElementById('ctl00_cphActualContents_ddlDomainType');
    var lstLanguages = document.getElementById('ctl00_ContentPlaceHolder1_CtrlCVProInfo1_lstBoxLanguages');
    
    if(lstLanguages != null)
    {        
        
            if(lstLanguages.value == "-1")
            {
                lstLanguages.focus();                
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;            
            }
       
    }   	
    else
    {
        args.IsValid = true; 
    }             	
}
/////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
function ListValidateCertification(source, args)
{       
    args.IsValid = false;
  //  var ddlDomainType = document.getElementById('ctl00_cphActualContents_ddlDomainType');
    var lstCertificate = document.getElementById('ctl00_ContentPlaceHolder1_CtrlCVProInfo1_lstBoxBoardOfCertification');
    
    if(lstCertificate != null)
    {        
        
            if(lstCertificate.value == "-1")
            {
                lstCertificate.focus();                
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;            
            }
       
    }   	
    else
    {
        args.IsValid = true; 
    }             	
}
/////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////
function ListValidateExpertise(source, args)
{       
    args.IsValid = false;
  //  var ddlDomainType = document.getElementById('ctl00_cphActualContents_ddlDomainType');
    var lstExp = document.getElementById('ctl00_ContentPlaceHolder1_CtrlCVProInfo1_lstBoxAreaOfExpertise');
    
    if(lstExp != null)
    {        
        
            if(lstExp.value == "-1")
            {
                lstExp.focus();                
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;            
            }
       
    }   	
    else
    {
        args.IsValid = true; 
    }             	
}
/////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
function ListValidateEvemtType(source, args)
{       
    args.IsValid = false;
  //  var ddlDomainType = document.getElementById('ctl00_cphActualContents_ddlDomainType');
    var lstEventType = document.getElementById('ctl00_ContentPlaceHolder1_CtrCvContactInfo1_lstBoxEventTypes');
    
    if(lstEventType != null)
    {        
        
            if(lstEventType.value == "-1")
            {
                lstEventType.focus();                
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;            
            }
       
    }   	
    else
    {
        args.IsValid = true; 
    }             	
}
/////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
function ListValidateCetificate(source, args)
{       
    args.IsValid = false;
  //  var ddlDomainType = document.getElementById('ctl00_cphActualContents_ddlDomainType');
    var lstCertificate = document.getElementById('ctl00_ContentPlaceHolder1_CtrlCVProInfo1_ddlBoardOfCertification');
   //  var chkYes = document.getElementById('ctl00_ContentPlaceHolder1_CtrlCVProInfo1_chkBoxHasCertificate');
    
    if(lstCertificate != null)
    {        
        
        if(chkYes !=null)
        {
            if(chkYes.checked)
            {
                if(lstCertificate.value == "-1")
                {
                    lstCertificate.focus();                
                    args.IsValid = false;
                }
                else
                {
                    args.IsValid = true;            
                }
            }
            else
            {
                 args.IsValid = true; 
            }
            
         }
         else
         {
            args.IsValid = true; 
         }
         
       
    }   	
    else
    {
        args.IsValid = true; 
    }             	
}
/////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////
function validateRecDate(source, args)
{       
    args.IsValid = false;
    var dStart = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_dtcDateStart_txtDate');
    var dEnd = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_dtcDateEnd_txtDate');
   //  var chkYes = document.getElementById('ctl00_ContentPlaceHolder1_CtrlCVProInfo1_chkBoxHasCertificate');
   // alert(dStart.value);
   //  alert(dEnd.value);
     var ValStart = dStart.value;
     var valEnd = dEnd.value;
     
     var index1 = ValStart.indexOf("/");
     var index2 = ValStart.lastIndexOf("/")
     
     var startMonth = ValStart.substr(0,index1);
     var t1 = index1+1;
     var t2 = index2-index1-1;
     var startDate = ValStart.substr(t1,t2);
     var t3 = index2+1;
      var startYear = ValStart.substr(t3,4);
      
     var index3 = valEnd.indexOf("/");
     var index4 = valEnd.lastIndexOf("/")
      
        var endMonth = valEnd.substr(0,index3);
      var t4 = index3+1;
     var t5 = index4-index3-1;
     var endDate = valEnd.substr(t4,t5);
       var t6 = index4+1;
      var endYear = valEnd.substr(t6,4);
   // return false;
    var flag=0;
    if(parseInt(endYear) < parseInt(startYear))
    {
        flag=1;
    }
    else if (parseInt(endYear) == parseInt(startYear))
    {
    
        if(parseInt(endMonth) < parseInt(startMonth))
        {
            flag=1;
        }
        else if(parseInt(endMonth) == parseInt(startMonth))
        {
                if(parseInt(endDate) < parseInt(startDate))
                {
                    flag=1;
                }  
        }
        
    }
  
    
                if(flag == 1)
                {
                              
                    args.IsValid = false;
                }
                else
                {
                    args.IsValid = true;            
                }
                	
}
/////////////////////////////////////////////////////////////////////////




//////////////////////////////////////////////////////////////////////////
//function ListValidateDOB(source, args)
//{       
//    args.IsValid = false;
//  //  var ddlDomainType = document.getElementById('ctl00_cphActualContents_ddlDomainType');
//    var DOB = document.getElementById('ctl00_ContentPlaceHolder1_CtrlEditUserProfile1_txtDOB');
//     
//    
//    if(DOB != null)
//    {      
//    
//        var txtDOB = DOB.value;
//          
//        var currentTime = new Date()
//        var month = currentTime.getMonth() + 1
//        var day = currentTime.getDate()
//        var year = currentTime.getFullYear()
//        if(month.length =1 )
//        {
//            month = '0' + month ;
//        }
//        alert(month);
//         if(day.length =1 )
//        {
//            day = '0' + day ;
//        }
//         alert(day);
//         
//         
//              
//    }   	
//    else
//    {
//        args.IsValid = true; 
//    }             	
//}
/////////////////////////////////////////////////////////////////////////



///////////////////////////////////////////////////////////////////////////
//Count Characters General
///////////////////////////////////////////////////////////////////////////
function CountCharactersGeneral(sourceTextBox, displayControl, maxLength)
{

    if(sourceTextBox != null && displayControl != null)
    {
            sourceTextBox = document.getElementById(sourceTextBox);
            displayControl = document.getElementById(displayControl);
            if(sourceTextBox != null)
            {
                var len = sourceTextBox.value.length
                if (len<=maxLength)
                {
                    //displayControl.value = maxLength -len;
                    displayControl.innerHTML = maxLength -len + " Character(s) remaining.";
                }
                else
                {
                    sourceTextBox.value = sourceTextBox.value.substring(0, maxLength);
                    return false;
                }
           }
    }
}

////////////////////////////////////*********//////////////////////////
function SelRecType(block)
	{
	 // alert(block);
	 //ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_tbFreq1
	 //
	 var txt1 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_tbFreq1');
	 var txt2 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_tbMonthDay31');
	 var txt3 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_tbFreq31');
	 var txt4 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_tbMonthDay41');
	 
	 txt1.value = '1';
	 txt2.value = '1';
	 txt3.value = '1';
	 txt4.value = '1';
	 
	 
	 var tblDaily = document.getElementById('tblDaily');
	 
	  var tblWeekly = document.getElementById('tblWeekly');
	  var tblMonthly = document.getElementById('tblMonthly');
	  var tblYearly = document.getElementById('tblYearly');
        //alert(block);
	  
	   tblDaily.style.display="none";
		//tblDaily.style.display="none";
		tblWeekly.style.display="none";
		tblMonthly.style.display="none";
		tblYearly.style.display="none";


		switch (block)
		{
			case 0:
			    tblDaily.style.display="";
				//tblDaily.style.display="block";
				break;
			case 1:
			tblWeekly.style.display="";
				break;
			case 2:
				tblMonthly.style.display="";
				break;
			case 3:
				tblYearly.style.display="";
		}
		
		}
		
		function setFalse()
		{
	          
	          
		    var ctrl1 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_customVallstdtcDateEnd');
		    var ctrl2 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_dtcDateEnd_cmpValtxtDate');
		  var ctrl3 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_dtcEndDate_cmpValtxtDate');
		    
		    
   		  var ctrl4 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_dtcTimeStart_RegularExpressionValidator3');
    	  var ctrl5 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_dtcTimeEnd_RegularExpressionValidator3');

		    //ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_dtcTimeStart_RegularExpressionValidator3
		    //ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_dtcTimeEnd_RegularExpressionValidator3
		    
		    
		  // alert('hi');
		   if(ctrl1 !=null)
		   {
		  
		    ctrl1.enabled = false;
		
		   }
		   if(ctrl2 !=null)
		   {
		    ctrl2.enabled = false;
		   
		   }
		   if(ctrl3 !=null)
		   {
		  
		  ctrl3.enabled = false;
		   }
		   
		    if(ctrl4 !=null)
		   {
		  
		    ctrl4.enabled = false;
		
		   }
		   
		    if(ctrl5 !=null)
		   {
		  
		    ctrl5.enabled = false;
		
		   }
		 //    alert('bye');
		 //   ctrl1.visibilty = false;
		     
		    //   ctrl2.visibilty = false;
		    
		}
		
		function setTrue()
		{
		
		
		    var ctrl1 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_customVallstdtcDateEnd');
		    var ctrl2 = document.getElementById('ctl00_ContentPlaceHolder1_EventEdit1_RecEditor1_dtcDateEnd_cmpValtxtDate');
		    ctrl2.enabled = true;
		    ctrl1.enabled = true;
		     // ctrl1.visibilty = true;
		     
		    //  ctrl2.visibilty = true;
		    
		}
