﻿

// JScript File

String.prototype.endsWith = function(str) 
{return (this.match(str+"$")==str)}

 function FixMemberPanelHeight()
{
    var maxH = "420";
    var id = "ctl00_divMemberContents";
    var d = document.getElementById(id);
    if (d.offsetHeight < maxH) 
    {
        d.style.height = maxH+"px";        
        
    }
}
 function lnkProductDetailsclick(pnldetails,pnlterms,srtPath,PanelNumber,detailleft,detailcenter,detailright,termsleft,termcenter,termright)
 {    
    var pnldetailsId =  document.getElementById(pnldetails);
    var pnlterms =   document.getElementById(pnlterms); 
    var divleft=document.getElementById(termsleft);
    var divmid=document.getElementById(termcenter);
    var divright=document.getElementById(termright);
    var divleftdetals=document.getElementById(detailleft);
    var divmiddetals=document.getElementById(detailcenter);
    var divrightdetals=document.getElementById(detailright);
        
    if(PanelNumber=='1')
    {      
        pnlterms.style.display = "none";
        pnldetailsId.style.display = "block";          
       
        divleft.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_left_bg_grey.gif)';
        divmid.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_cen_bg_grey.gif)';
        divright.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_top_right_bg_grey.gif)';        
        
        divleftdetals.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_left_bg.gif)';
        divmiddetals.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_cen_bg.gif)';
        divrightdetals.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_top_right_bg.gif)'; 
        
    }
    else if (PanelNumber=='2')
    {
             
        pnlterms.style.display = "block";
        pnldetailsId.style.display = "none";        
      
         divleft.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_left_bg.gif)';
        divmid.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_cen_bg.gif)';
        divright.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_top_right_bg.gif)';       
        
	    divleftdetals.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_left_bg_grey.gif)';
        divmiddetals.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_cen_bg_grey.gif)';
        divrightdetals.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_top_right_bg_grey.gif)';     
    }    
 }
 
 function lnktermsconditionsclick(pnldetails,pnlterms)
 {  
    var pnldetailsId =  document.getElementById(pnldetails);
    var pnlterms =   document.getElementById(pnlterms);    
   if(pnlterms.style.display == "none")
    {      
        pnlterms.style.display = "block";
        pnldetailsId.style.display = "none"; 
        ChangeTabDetails(pnldetails,"Application");
    }   
     
 }
 
 function ChangeTabDetails(pnldetailid,srtPath)
 { 
    
     var pnldetailsId =  document.getElementById(pnldetailid);
     var divname;
      if(pnldetailsId.style.display == "none")
      {
           
          divname = "divProductDetails";
      
      }
      else
      {   
         divname = "divtermscondition";
      }
      
 
    var divleft=document.getElementById("ctl00_ctn1_ctrlproductdetails_"+divname+"left");
	var divmid=document.getElementById("ctl00_ctn1_ctrlproductdetails_"+divname);
	var divright=document.getElementById("ctl00_ctn1_ctrlproductdetails_"+divname+"right");
    divleft.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_left_bg_grey.gif)';
    divmid.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_cen_bg_grey.gif)';
    divright.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_top_right_bg_grey.gif)';
 }




function IsRequireEditior()
{     
       var str;      
     if(document.all)
        {             
            str = window.frames[0][0].document.body.innerText;              
             if( str.length > 0) 
             {
                
             }
             else
             {
                alert('Please enter description');
               
             }
          }
       
}

function Occupancybandddlload(ddlid,txtid)
{     
       alert('hi');
       var ddlId =  document.getElementById(ddlid);
       var txtid =  document.getElementById(txtid);          
       if(parseInt(ddlId.value) == 0)
        {            
          txtid.readOnly=true;
        }
        else
        {             
          txtid.readOnly=false;
        }    
}






  function Occupancybandddlchaged(ddlid,txtid)
{     
       var ddlId =  document.getElementById(ddlid);
       var txtid =  document.getElementById(txtid);
       
       if(parseInt(ddlId.value) == 0)
        {            
          txtid.readOnly=true;
        }
        else
        {             
          txtid.readOnly=false;
        }    
}



function IsRequirebookingID(source, arguments)
{    
    var TxtNoOfmale='';
    /*for(i = 0; i < document.forms[0].elements.length; i++)
     {
        elm = document.forms[0].elements[i]
                
        if (elm.type == 'text') 
        {                        
            if(elm.name.indexOf("ctl00$ctl05$txtBookingRef")>0)
            {    
                
                TxtNoOfmale=trim(elm.value);  
                break;                  
            }
        }
     }*/
     var obj = document.getElementById('ctl00_ctl05_txtBookingRef');
     if (obj !=null)
     {
        TxtNoOfmale = trim(obj.value);
     }
   
     var NO=document.getElementById('ctl00_ctl05_rbByBooking');
     var YES=document.getElementById('ctl00_ctl05_rbByName');
     if (NO != null)
     {
        if(NO.checked)
        {
            if(parseFloat(TxtNoOfmale)>0)
            {                
                arguments.IsValid = true;
                return true;
            }
            else
            {                
                arguments.IsValid = false;
                return false;
            } 
         }
     }
}

function IsRequireFName(source, arguments)
{    
    var objN1 = document.getElementById('ctl00_ctl05_txtFirstName');
     var YES=document.getElementById('ctl00_ctl05_rbByName');
     if (YES != null)
     {
        if(YES.checked)
        {
            if (objN1 != null) 
            {
                if(objN1.value.length>0) 
                {                
                    arguments.IsValid = true;
                    return true;
                }
                else
                {                
                    arguments.IsValid = false;
                    return false;
                } 
            }
            else
            {
                arguments.IsValid = true;
                return false;
            }
         }
     }
}

function IsRequireLName(source, arguments)
{    
    var objN2 = document.getElementById('ctl00_ctl05_txtLastName');
     var YES=document.getElementById('ctl00_ctl05_rbByName');
     if (YES != null)
     {
        if(YES.checked)
        {
            if (objN2 != null)
            {
                if (objN2.value.length>0)
                {                
                    arguments.IsValid = true;
                    return true;
                }
                else
                {                
                    arguments.IsValid = false;
                    return false;
                } 
            }
            else
            {
                arguments.IsValid = true;
                return false;
            }
         }
     }
}


function Test(ddlctrl,lblctrl,val,curr,hid1,hid2,strPropCurrency,PMarkUp,PBaseRate,SMarkUp,SBaseRate,HiddenFieldavailbility,HiddenFieldMinimumStay,RowIndex,IsDefault)
{

    var l = document.getElementById(lblctrl);
    var d = document.getElementById(ddlctrl);
    var v = d.options[d.selectedIndex].value;  
    
   if(false==CompareMinstayAvail(RowIndex,HiddenFieldavailbility,HiddenFieldMinimumStay))
   {
    d.selectedIndex=0;
    return false; 
   }       

        if(IsDefault == 'True')
            {
                l.innerHTML = curr + ' ' + ReturnValue(d.selectedIndex * val);
            }    
      else
            {                        
                l.innerHTML = curr + ' ' + ReturnValue(v * val); 
            }                        

    var txthidtotbeds = document.getElementById(hid1);
    if (txthidtotbeds != null)
    {
        var lastctrl;
        var intTotBeds = 0;
        var s="";
        var aTotBeds = txthidtotbeds.value.split('#') ;
	    for ( var i = 0 ; i < aTotBeds.length ; i++ )
	    {
		    if ( aTotBeds[i].length == 0 )
			    continue ;
			
			if (i != (aTotBeds.length - 1))
			{    
			    var ddlctrl = document.getElementById(aTotBeds[i]);
			    
			 
			      
			    if (ddlctrl != null)
			    {
			        s = ddlctrl.options[ddlctrl.selectedIndex].value;
			        
			        intTotBeds = intTotBeds + parseInt(s);
			    }
			}
		    else
		    {
		        lastctrl = document.getElementById(aTotBeds[i]);
		    }
		}
		lastctrl.innerHTML = intTotBeds;
    }
    
    var txthidtotprice = document.getElementById(hid2);
    
    if (txthidtotprice != null)
    {
        var lastpricectrl;
        var intTotPrice = 0;
        var p="";
        var dvalue=0;
        var aTotPrice = txthidtotprice.value.split('#') ;
	    for ( var j = 0 ; j < aTotPrice.length ; j++ )
	    {
		    if ( aTotPrice[j].length == 0 )
			    continue ;
			
			if (j != (aTotPrice.length - 1))
			{    
			    var lblctrl = document.getElementById(aTotPrice[j]);
			    if (lblctrl != null)
			    {
			        p = lblctrl.innerHTML.split(' ')[1];
			        
			        if (parseFloat(p) >= 0)
			        {
			        
			            intTotPrice = ReturnDecimalValue(intTotPrice,p);
			            intTotPrice=ReturnValue(intTotPrice)
			            
			            //intTotPrice = intTotPrice + parseFloat(p);
			            //intTotPrice = parseFloat(intTotPrice) + parseFloat(p);
			            //intTotPrice = Number(parseInt(intTotPrice)).toFixed(2);
			        }
			    }
			}
		    else
		    {
		        lastpricectrl = document.getElementById(aTotPrice[j]);
		    }
		}
		
		
		// Convert Amount To Property Currency
		var PriceInPropertyCurrency=0;
		var ConverAmtToBaseCurrency=0;
		ConverAmtToBaseCurrency=intTotPrice/SBaseRate;
		
		var PropertyCurrencyCurrency=0;
		PriceInPropertyCurrency=ReturnValue(ConverAmtToBaseCurrency * PBaseRate);
		// END Convert Amount To Property Currency
		
		
		//var PriceInPropertyCurrency=0;
		//Price in Property Currency
		//if(CurrencyID !=PropertyCurrencyID)
		//{    
	         //PriceInPropertyCurrency=(((PBaseRate * PMarkUp)/100) + parseFloat(PBaseRate))* intTotPrice;
	         //PriceInPropertyCurrency=ReturnValue(PriceInPropertyCurrency);
		//}
		lastpricectrl.innerHTML = curr + ' ' + intTotPrice 
		//lastpricectrl.innerHTML = curr + ' ' + intTotPrice + ' ' + '(' + strPropCurrency + ' ' + PriceInPropertyCurrency + ')';
		//lastpricectrl.innerHTML = curr + ' ' + intTotPrice;
    }
   
}


 
   
function checkChain(checkboxid,TextBoxId,DropDownlist)
{
 var chkId = document.getElementById(checkboxid);
 var txtid = document.getElementById(TextBoxId);
 var ddlId =  document.getElementById(DropDownlist);
   
if( chkId.checked)
    {     
        
        if(txtid.value.length > 0 && ddlId.value.length > 1)        
        {         
            if(txtid.value !=  ddlId.value)
            {
                   
                 return confirm('chain code selected from dropdown is different from the code entered in textbox.Property will be addes under the chain selected from TextBox .Click OK to proceed or cancel the change?');
            } 
        }           
   }
}
   
 function CheckOffer(ddlOfTyp,txtPr,txtFrNgh,rbDiscTyp,txtDiscAmt,txtDiscPer,lstProd,chkIsMinPrReq,txtMinPr,ddlApTo,lstGrp,lstProp,lbrmtp,rbIsLim,txtLimCnt,lbgrouprmtp,chkMinNght,txtMinNgh,chkMinPpl,txtMinPpl)
 {
    var ddlOfTyp = document.getElementById(ddlOfTyp);
    var txtPr = document.getElementById(txtPr);
    var txtFrNgh = document.getElementById(txtFrNgh);
    var rbDiscTyp= document.getElementById(rbDiscTyp+'_1');
    var txtDiscAmt = document.getElementById(txtDiscAmt);
    var txtDiscPer = document.getElementById(txtDiscPer);
    var lstProd = document.getElementById(lstProd);
    var chkIsMinPrReq = document.getElementById(chkIsMinPrReq);
    var txtMinPr = document.getElementById(txtMinPr);
    var ddlApTo = document.getElementById(ddlApTo);
    var lstGrp = document.getElementById(lstGrp);
    var lstProp = document.getElementById(lstProp);
    var lbrmtp = document.getElementById(lbrmtp);
    var rbIsLim0 = document.getElementById(rbIsLim+'_0');
    var rbIsLim1 = document.getElementById(rbIsLim+'_1');
    var txtLimCnt = document.getElementById(txtLimCnt);
    var lbgrouprmtp = document.getElementById(lbgrouprmtp);
    var chkMinNght = document.getElementById(chkMinNght);
    var txtMinNgh = document.getElementById(txtMinNgh);
    var chkMinPpl = document.getElementById(chkMinPpl);
    var txtMinPpl = document.getElementById(txtMinPpl);
    
    if (ddlOfTyp != null)
    {
        switch(ddlOfTyp.value)
        {
            case '1':
                if (txtPr != null)
                {   
                    if (parseFloat(txtPr.value) <= 0)
                    {
                        alert('Fixed price should be more than ZERO');
                        return false;
                    }
                }
                break;
            case '2':
                if (txtFrNgh != null)
                {
                    if (parseFloat(txtFrNgh.value) <= 0)
                    {
                        alert('No. of free nights should be more than ZERO');
                        return false;
                    }
                }
                break;   
            case '3':
                if (rbDiscTyp != null)
                {
                     if(rbDiscTyp.checked)
                     {
                        if (txtDiscPer != null)
                        {
                            if (parseFloat(txtDiscPer.value) <= 0)//discount percentage
                            {
                                alert('Discount percentage should be more than ZERO');
                                return false;
                            }
                        }
                     }
                    else
                     {
                        if (txtDiscAmt != null)
                        {
                            if (parseFloat(txtDiscAmt.value) <= 0)//discount amount
                            {
                                alert('Cash discount amount should be more than ZERO');
                                return false;
                            }
                        }
                     }
                }
                break;   
            case '5':
                if (lstProd != null)
                {
                    if (lstProd.value <= 0)
                    {
                        alert('Please select at least one product');
                        return false;
                    }
                }
                break;    
        }
    }
    if (chkMinNght != null)
    {
        if(chkMinNght.checked)
        {
            if (txtMinNgh != null)
            {
                if (parseInt(txtMinNgh.value) <= 0)
                {
                    alert('Minimum nights required (in pre-requisites) should be more than ZERO');
                    return false;
                }
            }
        }
    }
    if (chkIsMinPrReq != null)
    {
        if(chkIsMinPrReq.checked)
        {
            if (txtMinPr != null)
            {
                if (parseFloat(txtMinPr.value) <= 0)//discount amount
                {
                    alert('Minimum price required (in pre-requisites) should be more than ZERO');
                    return false;
                }
            }
        }
    }
    if (chkMinPpl != null)
    {
        if(chkMinPpl.checked)
        {
            if (txtMinPpl != null)
            {
                if (parseInt(txtMinPpl.value) <= 0)//discount amount
                {
                    alert('Minimum people required (in pre-requisites) should be more than ZERO');
                    return false;
                }
            }
        }
    }
    if (rbIsLim1 != null)
    {
        if(rbIsLim1.checked)
        {
            if (txtLimCnt != null)
            {
                if (parseInt(txtLimCnt.value) <= 0)//discount amount
                {
                    alert('Limit count should be more than ZERO');
                    return false;
                }
            }
        }
    }
        
    var blnChkRoomTypeSelect = 0;
    if (ddlApTo != null)
    {
       switch(ddlApTo.value)
       {
           case '1':
                if (lstGrp != null)
                {
                    if (lstGrp.value <=0)
                    {
                        alert('Please select at least one group.');
                        return false;
                    }
                }
                blnChkRoomTypeSelect = 1;
                break;
            case '2':
                blnChkRoomTypeSelect = 1;
                break;
            case '3':
                if (lstProp != null)
                {
                    if (lstProp.value <=0)
                    {
                        alert('Please select at least one property.');
                        return false;
                    }
                }
                blnChkRoomTypeSelect = 1;
                break;
            case '4':
                break;
            case '5':
                if (lbgrouprmtp != null)
                {
                    if (lbgrouprmtp.value <=0)
                    {
                        alert('Please select at least one room type.');
                        return false;
                    }
                }
                break;
        }
    }
    if (blnChkRoomTypeSelect == 1)
    {
        if (lbrmtp != null)
        {
            if (lbrmtp.value <=0)
            {
                alert('Please select at least one room type.');
                return false;
            }
        }    
    }
    
    return true;
 }  
 function CheckEditorLength(maxlen)
{      
    
    var IsOK;
    var DescText;
    var DescHTML;
    var maximumlength = parseInt(maxlen);
    IsOK=true;
      
    for(var i=0;i<2;i++)
    {       
         _text=(/(microsoft|opera)/i.test(navigator.appName)) ? window.frames[i][0].document.body.innerText : window.frames[i][0].document.body.textContent;  
        DescText=   _text;               
        DescHTML = window.frames[i][0].document.body.innerHTML;           
                     
        if(DescText.length > parseInt(maxlen))
        {	                      
	         window.frames[i][0].document.body.innerHTML = DescHTML.substring(0,maximumlength);	                	              
	         alert("Only "+maxlen +" characters are allowed.");	                 
	         IsOK=false;	               
        }
        if(IsOK == false)
          {
              return false;
            
          }
          else
           {
             continue;
           }
     }    
}

function EditorLength(maxlen)
{      
    var IsOK;
    var DescText;
    var DescHTML;
    var maximumlength = parseInt(maxlen);
    IsOK=true; 
        
         _text=(/(microsoft|opera)/i.test(navigator.appName)) ? window.frames[0][0].document.body.innerText : window.frames[0][0].document.body.textContent;  
        DescText=   _text;          
        DescHTML = window.frames[0][0].document.body.innerHTML;           
                     
        if(DescText.length > parseInt(maxlen))
        {	                      
	         window.frames[0][0].document.body.innerHTML = DescHTML.substring(0,maximumlength);	                	              
	         alert("Only "+maxlen +" characters are allowed.");	                 
	         IsOK=false;	               
        }
         return  IsOK;
         
}




 function EditorLengthfordescription(maxlen)
{      
    var IsOK;
    var DescText;
    var DescHTML;
    var maximumlength = parseInt(maxlen);
    IsOK=true; 
        
         _text=(/(microsoft|opera)/i.test(navigator.appName)) ? window.frames[0][0].document.body.innerText : window.frames[0][0].document.body.textContent;  
        DescText=   _text;          
        DescHTML = window.frames[0][0].document.body.innerHTML;           
        if(DescText.length == 0)
        {        
            alert("Please enter detailed Description.");	                 
	        IsOK=false;
        }            
        else if(DescText.length > parseInt(maxlen))
        {	                      
	         window.frames[0][0].document.body.innerHTML = DescHTML.substring(0,maximumlength);	                	              
	         alert("Only "+maxlen +" characters are allowed.");	                 
	         IsOK=false;	               
        }
         return  IsOK;
         
}

function fixMemberHeight()
{
    var maxH = document.body.clientHeight;   
    var d = document.getElementById("ctl00_divMemberContents");
    if (d.offsetHeight > (maxH-200)) 
    {
        maxH = d.offsetHeight;
        
    }
    d.style.height = (maxH-500)+"px";
}

function fixRightLeftheightAdmin()
{
    var maxH = 0;
    var ids = ["divleft","divright"];
  
        for (var i=0; i<ids.length; i++)
        {
        
            var d = document.getElementById(ids[i]);
            d.style.height = "";
            if (d.offsetHeight > maxH) 
                {
                    maxH = d.offsetHeight;
                    
                }
        }
        for (var i=0; i<ids.length; i++)
        {
            var d=document.getElementById(ids[i]);
            d.style.height = maxH+"px";
        }

    
}

function SetHightGroupInner()
{

    var r = document.getElementById("divright");
    var l = document.getElementById("divleft");
    if ((r != null) && (l != null))
    {
        if (r.offsetHeight > l.offsetHeight)
        {   
            H = r.offsetHeight+50;        
        }
        else
        {   
            H = l.offsetHeight+50;        
        }
        
         l.style.height = H +'px';
         r.style.height = H +'px';    
    }      
}

function TestHeight()
{
    var r = document.getElementById("divright");
    var l = document.getElementById("divleft");
    var H;
    
    if (r.offsetHeight > l.offsetHeight)
    {
        H = r.offsetHeight+50;        
    }
    else
    {
        H = l.offsetHeight+50;        
    }
     l.style.height = H +'px';
     r.style.height = H +'px';    
      
}

function fixheight(Role)
{

var maxH = 0;
if (Role == 'Admin')
{
//    var ids = ["leftdiv","rightdiv"];
// // find the highest column
//    for (var i=0; i<ids.length; i++) 
//    {
//      var d = document.getElementById(ids[i]);
//      d.style.height = ""; // important, set it to empty (mozilla, ie)
//      if (d.offsetHeight > maxH) maxH = d.offsetHeight;
//    }
//     // set them all to be that height
//     //maxH = maxH;
//    
//    if (maxH < 500) 
//        maxH = 520;
//     
//     
////     var browserName=navigator.appName; 
////    if (browserName=="Netscape")
////    { 
////        alert(document.getElementById("LeftSpacer").style.height = maxH  + "px");
////        document.getElementById("LeftSpacer").style.height = maxH - 93 + "px" ;
////    }
////    else 
////    { 
////    if (browserName=="Microsoft Internet Explorer")
////    {
////        document.getElementById("LeftSpacer").style.height = maxH - 144 + "px" ;
////    }
////    else
////    {
////        document.getElementById("LeftSpacer").style.height = maxH - 144 + "px" ;
////    }
////    }

//     
//     
//     document.getElementById("LeftSpacer").style.height = maxH - 144 + "px" ;
//     document.getElementById("LeftSpacer1").style.height = maxH - 144 + "px" ;
//     
//     
//     
//     //alert(document.getElementById("LeftSpacer").style.height);
//     
//     
//     
//     
//    for (var i=0; i<ids.length; i++) 
//    {
//     var d=document.getElementById(ids[i]);
//     d.style.height = maxH+"px";
//    }



     var ids = ["leftdiv","rightdiv"];
     
     // find the highest column
     for (var i=0; i<ids.length; i++)
      {
          var d = document.getElementById(ids[i]);
          d.style.height = ""; // important, set it to empty (mozilla, ie)
            
          if (d.offsetHeight > maxH)
          {
           maxH = d.offsetHeight;
          }
      }
   
     var _docHeight = (document.height !== undefined) ? document.height : document.body.offsetHeight;
     // set them all to be that height
     for (var i=0; i<ids.length; i++) 
     {
          var d=document.getElementById(ids[i]);
          d.style.height = maxH+"px";
     }
}
else if(Role == 'Member')
{
var ids = ["leftdiv","rightdiv"];
 // find the highest column
    for (var i=0; i<ids.length; i++) 
    {
      var d = document.getElementById(ids[i]);
      if(d !=null)
      {
        d.style.height = ""; // important, set it to empty (mozilla, ie)
        if (d.offsetHeight > maxH) 
        {
        maxH = d.offsetHeight;
        }
      }
    }
     // set them all to be that height
     //maxH = maxH;
     var LSpacer= document.getElementById("LeftSpacer");
     if(LSpacer !=null)
     {
     document.getElementById("LeftSpacer").style.height = maxH - 424 + "px" ;
     }
    for (var i=0; i<ids.length; i++) 
    {
     var d=document.getElementById(ids[i]);
     if(d !=null)
     {
        d.style.height = maxH+"px";
      }
    }
   
}
     var LSpacer1=document.getElementById("LeftSpacer1")
     if(LSpacer1 !=null)
     {
        document.getElementById("LeftSpacer1").style.height = maxH - 140 + "px" ;
     }
    
}

function SetAdminLoginSpacerDiv()
{
    var maxH = 400;
    var LSpacer1=document.getElementById("LeftSpacer1")
     if(LSpacer1 !=null)
     {
        document.getElementById("LeftSpacer1").style.height = "260px" ;
     }
}


//Control panel javascript
var mouseOverEffectEnabled = false;

function ToggleView(div,image) 
{
				if (document.getElementById(div).style.display == "none") 
				{
					mouseOverEffectEnabled = false;
					document.getElementById(image).src = "/SmartBackPackers/images/open.gif";
					document.getElementById(div).style.display = "";
				} 
				else 
				{
					mouseOverEffectEnabled = true;
					document.getElementById(div).style.display = "none";
					document.getElementById(image).src = "/SmartBackPackers/images/closed.gif";
				}
				fixheight('Admin');
				
}
			
			
			function SetMouseOverImg(div,image) 
			{
				if (document.getElementById(div).style.display == "none") 
					document.getElementById(image).src = "/SmartBackPackers/images/openMe.gif";
				else
				    document.getElementById(image).src = "/SmartBackPackers/images/closeMe.gif";	
		    }

			function SetMouseOutImg(div,image) {
					document.getElementById(image).src = "/SmartBackPackers/images/closed.gif";
			}
//			function ShowDiv(div)
//			{
//			    alert(div);
//			    document.getElementById(div).style.display == "none";
//			}



//function CheckAllProperty(checkAll, element)
//{
//    var chkList1 = document.getElementById(element);
//    if(checkAll.checked)
//    {  
//   
//    var checkboxes = request..form.elements; 
//    for( i=0; i<checkboxes.length; i++) 
//    { 
//        if(checkboxes[i].type == "checkbox" 
//    }

//}


////==========================================
//// Check All boxes
////==========================================
//function CheckAllProperty(fmobj) {
//  for (var i=0;i<fmobj.elements.length;i++) {
//    var e = fmobj.elements[i];
//    if ( (e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled) ) {
//      e.checked = fmobj.allbox.checked;
//    }
//  }
//}

//==========================================
// Check all or uncheck all?
//==========================================
function CheckAllProperty(field) 
{
       
     //var checkProperty=document.getElementById('ctl00_ctn1_cblForProperty');
     
    


//  var TotalBoxes = 0;
//  var TotalOn = 0;
//  for (var i=0;i<fmobj.elements.length;i++) {
//    var e = fmobj.elements[i];
//    if ((e.name != 'allbox') && (e.type=='checkbox')) {
//      TotalBoxes++;
//      if (e.checked) {
//       TotalOn++;
//      }
//    }
//     
//  }
//   if(checkAll.checked)
//    { 
//   
//        if (TotalBoxes==TotalOn) 
//        {
//            fmobj.allbox.checked=true;
//        }
//    }
//            
//  else 
//    {
//            fmobj.allbox.checked=false;
//    }
}


//Create By : Girish Sharma
// Create Date : 1-08-2007
// Module : ManageFacility

function IsPropertycheck(source, arguments)
{
    var ReturnValue=false;
    var checkProperty=document.getElementById('ctl00_ctn1_radProperty');
    var checkRoom=document.getElementById('ctl00_ctn1_radRoom');
    var ddlPropertValue= document.getElementById('ctl00_ctn1_ddlPropertyType');
    
    
    if(checkProperty.checked)
    {
          ReturnValue=true;
           arguments.IsValid = true;
    }
    else
    {
        if(ddlPropertValue.value >=1)
        { 
           ReturnValue=true;
           arguments.IsValid = true;
        }
     else
        {
            arguments.IsValid = false;
            ReturnValue=false
        }
    }
    
    return ReturnValue;
}

function ShowHideChain(check,div)
{
    var flag;
    flag	=	document.getElementById(check).checked;
    //alert(flag);
    if (flag)
    {
     
        document.getElementById(div).style.display = "block";
    }
    else
    {
     
        document.getElementById(div).style.display = "none";
    }
}







function move(fbox, tbox) 
{     
    var arrFbox = new Array();     
    var arrTbox = new Array();     
    var arrLookup = new Array();     
    var i;     
    for (i = 0; i < tbox.options.length; i++) 
    {     
        arrLookup[tbox.options[i].text] = tbox.options[i].value;     
        arrTbox[i] = tbox.options[i].text;     
    }     
    var fLength = 0;     
    var tLength = arrTbox.length;     
    for(i = 0; i < fbox.options.length; i++) 
    {     
        arrLookup[fbox.options[i].text] = fbox.options[i].value;     
        if (fbox.options[i].selected && fbox.options[i].value != "") 
        {     
            arrTbox[tLength] = fbox.options[i].text;     
            tLength++;     
        }     
        else 
        {     
            arrFbox[fLength] = fbox.options[i].text;     
            fLength++;     
        }     
    }     
    arrFbox.sort();     
    arrTbox.sort();     
    fbox.length = 0;     
    tbox.length = 0;     
    var c;     
    for(c = 0; c < arrFbox.length; c++) 
    {     
        var no = new Option();     
        no.value = arrLookup[arrFbox[c]];     
        no.text = arrFbox[c];     
        fbox[c] = no;     
    }     
    for(c = 0; c < arrTbox.length; c++) 
    {     
        var no = new Option();     
        no.value = arrLookup[arrTbox[c]];     
        no.text = arrTbox[c];     
        tbox[c] = no;     
    }     
}     
//function selectAll(box) 
//{     
//    alert(box);
//    alert(box.items.count);
//    for(var i=0; i<box.length; i++) 
//    {     
//        box[i].selected = true;     
//    }     
//} 

function readListControl()
{

// var tableBody = document.getElementById('ctl00_ctn1_chkMemberList'); 
// 
// var gg=document.getElementByTag('input')
// 

// for (var i=0;i<tableBody.childNodes.length; i++)
// {
//  var currentTd = tableBody.childNodes[i];
//  if(currentTd.checked)
//    currentTd.checked = false;
//  else
//    currentTd.checked = true;
// }

 var checkParent=document.getElementById('ctl00_ctn1_CheckBox3');
        var checkChild1=document.getElementById('ctl00_ctn1_chkMemberList_0');
        var checkChild2=document.getElementById('ctl00_ctn1_chkMemberList_1');
     if(checkParent.checked)
     {
        if(checkChild1!='null' && checkChild2!='null' )
        {
            checkChild1.checked=true;
            checkChild2.checked=true;
        }
     }
     else
     {
        if(checkChild1!='null' && checkChild2!='null' )
        {
            checkChild1.checked=false;
            checkChild2.checked=false;
        }
     }
}



function message(msg)
{
    alert(msg);
}

function ConfirmMessage()
{
    confirm('Are you sure you want to delete this record?');
}






// ************* For Check All and uncheck All ********************


function SelectAll(parentChkBox) 
{ 
    if(parentChkBox.checked) 
    {
        // We can move this information into a hidden field so that it will be available for postbacks 
        document.getElementById("ctl00_ContentPlaceHolder1_checkboxParentHidden").value = "parentChecked"; 
    }
    else 
    { 
        document.getElementById("ctl00_ContentPlaceHolder1_checkboxParentHidden").value = "parentNotChecked"; 
    } 
    var children = parentChkBox.children; 
    var theBox = (parentChkBox.type == "checkbox") ? parentChkBox: parentChkBox.children.item[0]; 
    var checkboxes = theBox.form.elements; 
    for( i=0; i<checkboxes.length; i++) 
    { 
        if(checkboxes[i].type == "checkbox" && checkboxes[i].id != parentChkBox.id) 
        {
            if(parentChkBox.checked)
            {
                checkboxes[i].checked = true;
            }
            else
            {
                checkboxes[i].checked = false;
            }
        } 
    } 
} 


function DeSelectCheckBoxes(spanChk) 
{
    var xState=spanChk.checked;
    var elm = document.getElementsByTagName('input'); 

    // this means chkBox is deselected
    if(xState == false) 
    {
        checkBoxes(xState,elm);
    }
    else//if(xState == true) Checkbox selected 
    {
        var allchkd=isAllChkd(elm); 
        if(allchkd==true) 
            checkBoxes(xState,elm);
    else 
        checkBoxes(!xState,elm);
    }
} 

function checkBoxes(xState,elm) 
{
    for(i=0;i<elm.length;i++) 
    {
        var currentid = elm[i].id; 
        if(elm[i].type=="checkbox" && currentid.indexOf("chkAll")!=-1 )//currentid.indexOf("chkAll")!=-1 -> to diff. bet'n header and row checkboxes 
        {
            elm[i].checked =xState; 
        }
    }
}

function isAllChkd(elm) 
{
    var allchkd=true; 
    for(i=0;i<elm.length;i++) 
    {
        var currentid = elm[i].id; 
        if(elm[i].type=="checkbox" && currentid.indexOf("SelectItem")!=-1) 
        { 
            if (elm[i].checked == false) 
                allchkd = false;
        } 
    }
    return allchkd; 
}

function CheckCheckboxesSelect()
{
    var chkSelected = false;
    var parentChkBox = document.getElementById('ctl00_ContentPlaceHolder1_gvManageEditedDocs_ctl01_chkAll');
    var children = parentChkBox.children; 
    var theBox = (parentChkBox.type == "checkbox") ? parentChkBox: parentChkBox.children.item[0]; 
    var checkboxes = theBox.form.elements; 
    for( i=0; i<checkboxes.length; i++) 
    { 
        if(checkboxes[i].type == "checkbox" && checkboxes[i].id != parentChkBox.id) 
        {
            if(checkboxes[i].checked)
            {
                chkSelected = true;
            }
        } 
    } 
    if(chkSelected == false)
	{
	    alert('Please select any document first.');
	    return false;
	}
	else
	{
	    return true;
	}
} 





function ThumbnailImagePopup(url,ImageName,imagetitle,ImagePath)
{

    var w=650;
	var h=300;
	var t=50;
	var l=50;
	var maxWidth=650;
	var maxHeight=300;
	if (document.all) 
	{
		maxWidth=screen.availWidth;
		maxHeight=screen.availHeight;
	}
	
	if (w > maxWidth) { w=maxWidth }
	if (h > maxHeight) { h=maxHeight }
	l=(maxWidth-w)/2
	t=(maxHeight-h)/2
	
	window.open(url + '?ImageName=' + ImageName +'&ImagePath=' + ImagePath +'&Title=' + imagetitle + '&Type=Thumbnail',"name","height="+h+",width="+w+",top="+t+",left="+l+",resizable=no,scrollbars=yes");	
	return false;
} 


function LargeImagePopup(url,ImageName,imagetitle,ImagePath)
{   
    var w=650;
	var h=600;
	var t=50;
	var l=50;
	var maxWidth=650;
	var maxHeight=600;

	if (document.all) 
	{
		maxWidth=screen.availWidth;
		maxHeight=screen.availHeight;
	}
	
	if (w > maxWidth) { w=maxWidth }
	if (h > maxHeight) { h=maxHeight }
	l=(maxWidth-w)/2
	t=(maxHeight-h)/2
	
	window.open(url + '?ImageName=' + ImageName +'&ImagePath=' + ImagePath  + '&Title=' + imagetitle + '&Type=Large',"name","height="+h+",width="+w+",top="+t+",left="+l+",resizable=no,scrollbars=yes");	
	return false;
}  

function LargeImageGalleryPopup(url,ImageID,ImageType,CountryID,StateID,CityID)
{   
    var w=800;
	var h=830;
	var t=0;
	var l=130;
	var maxWidth=800;
	var maxHeight=700;
	if (document.all) 
	{
		//maxWidth=screen.availWidth;
		//maxHeight=screen.availHeight;
	}
	if (w > maxWidth) { w=maxWidth }
	if (h > maxHeight) { h=maxHeight }
	//l=(maxWidth-w)/2
	//t=(maxHeight-h)/2
  
	//window.showModalDialog(url + '?ImageID=' + ImageID +'&ImageType=' + ImageType  + '&CountryID=' + CountryID + '&StateID=' + StateID + '&CityID=' + CityID + '&Type=Large',"name","height="+h+",width="+w+",top="+t+",left="+l+",resizable=no,scrollbars=yes");	
	window.open(url + '?ImageID=' + ImageID +'&ImageType=' + ImageType  + '&CountryID=' + CountryID + '&StateID=' + StateID + '&CityID=' + CityID + '&Type=Large',"name","height="+h+",width="+w+",top="+t+",left="+l+",resizable=no,scrollbars=yes");	
	//alert(url + '?ImageID=' + ImageID +'&ImageType=' + ImageType  + '&CountryID=' + CountryID + '&StateID=' + StateID + '&CityID=' + CityID + '&Type=Large');
	return false;
}  


function Resize350()
{       
   var intHeight =400;
   var intWidth =430;
   window.screenX =(screen.availWidth-intWidth+20)/2;          
   window.screenY =(screen.availHeight-intHeight+20)/2;
   //window.resizeTo(intWidth+20,intHeight+20); 
   window.moveTo(window.screenX,window.screenY);  //      
}  

function Resize550()
{   
   var intHeight=595;
   var intWidth=550;
   window.screenX =(screen.availWidth-intWidth+20)/2;          
   window.screenY =(screen.availHeight-intHeight+20)/2;
   //window.resizeTo(intWidth+20,intHeight+20); 
   window.moveTo(window.screenX,window.screenY);  //      
}  

function ResizeHostelRating500()
{   
   var intHeight=595;
   var intWidth=500;
   window.screenX =(screen.availWidth-intWidth+20)/2;          
   window.screenY =(screen.availHeight-intHeight+20)/2;
   //window.resizeTo(intWidth+20,intHeight+20); 
   window.moveTo(window.screenX,window.screenY);    
}  

function NewsLetterResize550()
{   
   var intHeight=895;
   var intWidth=850;
  /* window.screenX =(screen.availWidth-intWidth+20)/2;          
   window.screenY =(screen.availHeight-intHeight+20)/2;*/
   //window.resizeTo(intWidth+20,intHeight+20); 
   /*window.moveTo(window.screenX,window.screenY);  */    
} 
 
function termscondition()
{   
   var intHeight=500;
   var intWidth=500;
   window.screenX =(screen.availWidth-intWidth+20)/2;          
   window.screenY =(screen.availHeight-intHeight+20)/2;
   //window.resizeTo(intWidth+20,intHeight+20); 
   window.moveTo(window.screenX,window.screenY);  //      
}  
// to show hide the Loyalty Points 
// Dated 03/21/07
// Created By Ashish
function showHide(obj)
{

    var varRd1=document.getElementById('ctl00_ctn1_rdReward_0');
    var varRd2=document.getElementById('ctl00_ctn1_rdReward_1');
    var divItem=document.getElementById('divItem');
     var divdiscount=document.getElementById('divDiscount');
    if(varRd1.checked)
    {
       divdiscount.style.display ="";
       divItem.style.display='none'; 
       fixheight('Admin');
    }
    
    if(varRd2.checked)
    {
        
        divItem.style.display =""; 
        divdiscount.style.display='none'; 
        fixheight('Admin');
    }
    
    
}

function EnableFields(rbtnOption, Field1, Field2, Field3, whichrbtn)
{
    var varRd1 = document.getElementById(rbtnOption);
    var varField1 = document.getElementById(Field1);
    var varField2 = document.getElementById(Field2);
    var varField3 = document.getElementById(Field3);
    
    if(varRd1.checked && whichrbtn == "Ref")
    {
        varField1.disabled = false;
        varField1.focus();
        varField2.disabled = true;
        varField3.disabled = true;
    }
    else
    {
        varField1.disabled = true;
        varField2.disabled = false;
        varField3.disabled = false;
         varField2.focus();
    }
}

// Create BY    : Girish Sharma
// Create Date  : 30/07/2007
// Module : AdvertisementHotspot

function IsMultipleAdd(ChkIsMultipleAdd,ChkRotation)
{

    var  ChkIsMultipleAdd= document.getElementById(ChkIsMultipleAdd);
    var varRotation=document.getElementById(ChkRotation)
   if(ChkIsMultipleAdd !=null)
   {
        if(ChkIsMultipleAdd.checked)
        {
            //varRotation.disabled=false;
            varRotation.disabled=true;
             varRotation.checked=true;
        }    
        else
        {
            varRotation.disabled=true;
           varRotation.checked=false;
        }
   }
}

// Create BY    : Girish Sharma
// Create Date  : 30/07/2007
// Module : HotspotView

function AdvertisementSearchOption(ddlAdds,DivCode)
{
    var IsDisplay=false;
    var  ddlAddsSearchOption= document.getElementById(ddlAdds);
    var DivCodeSearchOption=document.getElementById(DivCode);
    if(ddlAddsSearchOption !=null)
    {
         switch(ddlAddsSearchOption.value)
           {
               case '0':
                    IsDisplay=false;
                    break;
               case '1':
                    IsDisplay=false;
                    break;
               case '2':
                    IsDisplay=false;
                    break;
               case '3':
                    IsDisplay=false;
                    break;
               case '4':
                    IsDisplay=false;
                    break;
               case '5':
                    IsDisplay=true;
                    break;
               case '6':
                    IsDisplay=true;
                    break;
           }
       
           if(IsDisplay)
           {
            DivCodeSearchOption.style.display = 'block';
           }
           else
           {
             DivCodeSearchOption.style.display = 'none';
           }
       }
}


function showmenu(elmnt,src)
{
document.getElementById(elmnt).style.visibility="visible"
document.getElementById(src).style.backgroundColor="transparent"
document.getElementById(src).style.color="#005FAF"

}
function hidemenu(elmnt,src)
{
document.getElementById(elmnt).style.visibility="hidden"
document.getElementById(src).style.color="#990033"

}
 
// function changeTab(divname, srtPath)
// { 
//    var divleft=document.getElementById("ctl00_ctl06_"+divname+"left");
//	var divmid=document.getElementById("ctl00_ctl06_"+divname);
//	var divright=document.getElementById("ctl00_ctl06_"+divname+"right");	

//    divleft.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_left_pink.png)';
//    divmid.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_cen_pink.png)';
//    divright.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_right_pink.png)';
// }
// 

function changeTab(divname,srtPath,divleft,divright)
 { 
    var divleft=document.getElementById(divleft);
	var divmid=document.getElementById(divname);
	var divright=document.getElementById(divright);	

    if (divleft != null)
    {
        divleft.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_left_pink.png)';
    }
    if (divmid != null)
    {
        divmid.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_cen_pink.png)';
    }
    if (divright != null)
    {
        divright.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_right_pink.png)';
    }
 }
 
 // Functon : changeTabSuper
 // Purpose :To set Tab BackColour for Super Admin
 // Created By Ashish
 // Dated : 18/06/07
 
// function changeTabSuper(divname, srtPath)
// { 
// 
//    var divleft=document.getElementById("ctl00_ctl06_"+divname+"left");
//	var divmid=document.getElementById("ctl00_ctl06_"+divname);
//	var divright=document.getElementById("ctl00_ctl06_"+divname+"right");
//    divleft.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_left_pink.png)';
//    divmid.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_cen_pink.png)';
//    divright.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_right_pink.png)';
// }

function changeTabSuper(divname, srtPath,divleft,divright)
 { 
 
    var divleft=document.getElementById(divleft);
	var divmid=document.getElementById(divname);
	var divright=document.getElementById(divright);
    divleft.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_left_pink.png)';
    divmid.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_cen_pink.png)';
    divright.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_right_pink.png)';
 }
 
 function SetMemberDefaultTabs(divname, srtPath)
 {
    var divleft=document.getElementById("ctl00_ctn1_"+divname+"left");
	var divmid=document.getElementById("ctl00_ctn1_"+divname);
	var divright=document.getElementById("ctl00_ctn1_"+divname+"right");
	divleft.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_left_bg.gif)';
    divmid.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_cen_bg.gif)';
    divright.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_top_right_bg.gif)';
 }
 function ShowHideHotelDetailsPanels(divHide1,divHide2,divHide3,divHide4,divHide5,divShow,divTab,strPath)
 {
    var pnl1=document.getElementById(divHide1);
    var pnl2=document.getElementById(divHide2);
    var pnl3=document.getElementById(divHide3);
    var pnl4=document.getElementById(divHide4);
    var pnl5=document.getElementById(divHide5);
    var pnlShow=document.getElementById(divShow);
    pnl1.style.display = "none";
    pnl2.style.display = "none";
    pnl3.style.display = "none";
    pnl4.style.display = "none";
    pnl5.style.display = "none";
    pnlShow.style.display = "";
    ChangeTabMember(divTab,strPath);
 }
 // Functon : changeTabMEmber
 // Purpose :To set Tab BackColour for Member Hostels details
 // Created By Preeti
 // Dated : 18/09/07
 
 function ChangeTabMember(divname, srtPath)
 { 
    SetMemberDefaultTabs('divOffer',srtPath);
    SetMemberDefaultTabs('divLocalInfo',srtPath);
    SetMemberDefaultTabs('divMaps',srtPath);
    SetMemberDefaultTabs('divReview',srtPath);
    SetMemberDefaultTabs('divRecent',srtPath);
    SetMemberDefaultTabs('divHostelDetails',srtPath);
    
    var divleft=document.getElementById("ctl00_ctn1_"+divname+"left");
	var divmid=document.getElementById("ctl00_ctn1_"+divname);
	var divright=document.getElementById("ctl00_ctn1_"+divname+"right");
    divleft.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_left_bg_grey.gif)';
    divmid.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_tab_cen_bg_grey.gif)';
    divright.style.backgroundImage='url('+ srtPath+'/images/Member/button_mem_top_right_bg_grey.gif)';
 }
 
 // Functon : changeTabMicroSite
 // Purpose :To set Tab BackColour for Super Admin
 // Created By Ashish
 // Dated : 25/07/07
 
 function changeTabMicroSite(divname, srtPath)
 {  
    var divleft=document.getElementById("ctl00_ctn1_ctrlMtab_"+divname+"Left");
	var divmid=document.getElementById("ctl00_ctn1_ctrlMtab_"+divname);
	var divright=document.getElementById("ctl00_ctn1_ctrlMtab_"+divname+"Right");
    divleft.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_left_pink.png)';
    divmid.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_cen_pink.png)';
    divright.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_right_pink.png)';
 }
 
 function changeYieldTabs(divname, srtPath)
 {   
    var divleft=document.getElementById(divname+"left");
	var divmid=document.getElementById(divname);
	var divright=document.getElementById(divname+"right");	    
    divleft.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_left_pink.png)';
    divmid.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_cen_pink.png)';
    divright.style.backgroundImage='url('+ srtPath+'/images/GroupAdmin/button_right_pink.png)';
 }
 
 //this function used for changing the arrow of the button control
 function changeButtonArrow(divleft1,divright1,srtPath,arrowDirection)
 {    
    var divleft=document.getElementById(divleft1);
    var divright=document.getElementById(divright1);  
    
  
    if (arrowDirection=="left")
    {  
    
      divleft.style.width ='20px';
      divright.style.width ='5px';
     
	 divleft.style.backgroundImage='url('+ srtPath+'/images/button_prev_left.gif)'; 	
     divright.style.backgroundImage='url('+ srtPath+'/images/button_prev_right.gif)'; 
     //alert(divright.style.width);    
    }
    else
    {
       divleft.style.width ='5px';
       divright.style.width ='20px';
      divleft.style.backgroundImage='url('+ srtPath+'/images/button_left.gif)';    
      divright.style.backgroundImage='url('+ srtPath+'/images/button_right.gif)';       
    }
 }
 
 //This function used for count the characters
 function charcount(ctrlsource,ctrldisplay)
 { 
   // var Desc = window.frames[0][0].document.body.innerText;
    document.getElementById(ctrldisplay).innerHTML = 'Character typed: ' + document.getElementById(ctrlsource).value.length;     
 }

 //Fill the same Contact values in the corresponding fields
 
function FillSameContactValue(status,GroupFirstName,FirstName,GroupLastName,LastName,GroupDesignation,Designation,GroupAdditionalContact,AdditionalContactPerson,GroupEmail,Email,GroupPhone,Phone,GroupFax,Fax)
{   
    
    if (status.checked)
    {
        document.getElementById(GroupFirstName).value = document.getElementById(FirstName).value;
        document.getElementById(GroupLastName).value = document.getElementById(LastName).value;
        document.getElementById(GroupDesignation).value = document.getElementById(Designation).value;
        document.getElementById(GroupAdditionalContact).value = document.getElementById(AdditionalContactPerson).value;
        document.getElementById(GroupEmail).value = document.getElementById(Email).value;
        document.getElementById(GroupPhone).value = document.getElementById(Phone).value;
        document.getElementById(GroupFax).value = document.getElementById(Fax).value;
    }
    else
    {
        document.getElementById(GroupFirstName).value = '';
        document.getElementById(GroupLastName).value = '';
        document.getElementById(GroupDesignation).value = '';
        document.getElementById(GroupAdditionalContact).value = '';
        document.getElementById(GroupEmail).value = '';
        document.getElementById(GroupPhone).value = '';    
        document.getElementById(GroupFax).value = '';    
    }
} 

//


function FillSameAdvertisementValue(status,ContactAddress1,InvoiceAddress1,ContactAddress2,InvoiceAddress2,ContactPostcode,CompanyPostcode,ContactCountryID,CompanyCountryID,ContactStateID,CompanyStateID,ContactCityID,CompanyCityID)
{   
    
    if (status.checked)
    {
        document.getElementById(InvoiceAddress1).value = document.getElementById(ContactAddress1).value;
        document.getElementById(InvoiceAddress2).value = document.getElementById(ContactAddress2).value;
        document.getElementById(CompanyPostcode).value = document.getElementById(ContactPostcode).value;
        document.getElementById(CompanyCountryID).value = document.getElementById(ContactCountryID).value;
        document.getElementById(CompanyStateID).value = document.getElementById(ContactStateID).value;
        document.getElementById(CompanyCityID).value = document.getElementById(ContactCityID).value;
        
    }
    else
    {
        document.getElementById(InvoiceAddress1).value = '';
        document.getElementById(InvoiceAddress2).value = '';
        document.getElementById(CompanyPostcode).value = '';
        document.getElementById(CompanyCountryID).value = 0;
        document.getElementById(CompanyStateID).value = 0;
        document.getElementById(CompanyCityID).value = 0;  
    }
} 

// Create BY : Girish
// Create Date : 23/07/2007
// Purpose : Use in ManageAnnouncement.aspx Page for Disable controls

function IsMemberForAnnouncement(ChkListValue,CblListPrpoerty)
{ 

//CblListPrpoerty.disabled=true;
//alert(CblListPrpoerty);

  //document.getElementById(CblListPrpoerty).enabled=false;
  //CblListPrpoerty.enabled = false;



//    if (ChkListValue.value=1)
//    {
//    
      
        //alert('a');
     //alert (ctl00_ctn1_radOptionFor_0.checked);
         //CblListPrpoerty.disabled=false;
//    }
//    else
//    {
    //alert ('2');
    //alert (ctl00_ctn1_radOptionFor_0.checked);
        //CblListPrpoerty.disabled=true;
      
   // }
    //ctl00_ctn1_cblForProperty
    //ctl00_ctn1_radOptionFor_0
    //ctl00_ctn1_radOptionFor_1
    //ctl00_ctn1_radOptionFor_2
} 





// Popup Calander

function PopupPicker(ctl, CalPagePath)
{
    var varSeletedDate = document.getElementById(ctl).value;
    var w = 230;
    var h = 230;
    var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
    var PopupWindow=null;
    settings='width='+ w + ',height='+ h + ',top='+wint+',left='+winl+ ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
    PopupWindow = window.open(CalPagePath + '?Ctl=' + ctl + '&selDate=' + varSeletedDate, 'DatePicker',settings);    
    if (parseInt(navigator.appVersion) >= 4) { PopupWindow.window.focus(); }
}

function PopupPickerWithMMDD(ctl, CalPagePath)
{
    var varSeletedDate = document.getElementById(ctl).value;
    var w = 220;
    var h = 200;
    var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
    var PopupWindow=null;
    settings='width='+ w + ',height='+ h + ',top='+wint+',left='+winl+ ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
    PopupWindow = window.open(CalPagePath + '?Ctl=' + ctl + '&IsMMDD=1&selDate=' + varSeletedDate, 'DatePicker',settings);
    
    if (parseInt(navigator.appVersion) >= 4) { PopupWindow.window.focus(); }
}

function SetVisibility(controlID,staus)
{
   document.getElementById(controlID).style.visibility = staus;
}



/******************************************************************/

// position of the tooltip relative to the mouse in pixel //
var offsetx = 12;
var offsety =  8;

function newelement(newid)
{ 
    if(document.createElement)
    { 
        var el = document.createElement('div'); 
        el.id = newid;     
        with(el.style)
        { 
            display = 'none';
            position = 'absolute';
        } 
        el.innerHTML = '&nbsp;'; 
        document.body.appendChild(el); 
    } 
} 
var ie5 = (document.getElementById && document.all); 
var ns6 = (document.getElementById && !document.all); 
var ua = navigator.userAgent.toLowerCase();
var isapple = (ua.indexOf('applewebkit') != -1 ? 1 : 0);
function getmouseposition(e)
{
    if(document.getElementById)
    {
        var iebody=(document.compatMode && 
        	document.compatMode != 'BackCompat') ? 
        		document.documentElement : document.body;
        pagex = (isapple == 1 ? 0:(ie5)?iebody.scrollLeft:window.pageXOffset);
        pagey = (isapple == 1 ? 0:(ie5)?iebody.scrollTop:window.pageYOffset);
        mousex = (ie5)?event.x:(ns6)?clientX = e.clientX:false;
        mousey = (ie5)?event.y:(ns6)?clientY = e.clientY:false;

        var lixlpixel_tooltip = document.getElementById('tooltip');
        lixlpixel_tooltip.style.left = (mousex+pagex+offsetx) + 'px';
        lixlpixel_tooltip.style.top = (mousey+pagey+offsety) + 'px';
        
    }
}
function tooltip(tip)
{
    if(!document.getElementById('tooltip')) newelement('tooltip');
    var lixlpixel_tooltip = document.getElementById('tooltip');
    lixlpixel_tooltip.innerHTML = tip;
    lixlpixel_tooltip.style.display = 'block';
    document.onmousemove = getmouseposition;
}
function exit()
{
    document.getElementById('tooltip').style.display = 'none';
}






//ANNOUNCEMENT SCROLLER
var delayb4scroll=2000; //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1; //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1; //Pause marquee onMousever (0=no. 1=yes)?

var copyspeed=marqueespeed;
var pausespeed=(pauseit==0)? copyspeed: 0;
var actualheight='';

function scrollmarquee()
{
    if(cross_marquee !=null)
    {
    if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
        cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px";
    else
        cross_marquee.style.top=parseInt(marqueeheight)+8+"px";
   }
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee");
marqueectrl=document.getElementById("marqueecontainer");
if (marqueectrl != null)
{
    marqueeheight=marqueectrl.offsetHeight;
}
if (cross_marquee != null)
{
    cross_marquee.style.top=0;
    actualheight=cross_marquee.offsetHeight;
}
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px";
cross_marquee.style.overflow="scroll";
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll);
}
//ANNOUNCEMENT SCROLLER

//SCROLLER COMMON 
if (window.addEventListener)
{
window.addEventListener("load", initializemarquee, false);
//window.addEventListener("load", initializenewsmarquee, false)
}
else if (window.attachEvent)
{
window.attachEvent("onload", initializemarquee);
//window.attachEvent("onload", initializenewsmarquee)
}
else if (document.getElementById)
{
window.onload=initializemarquee;
//window.onload=initializenewsmarquee
}
//SCROLLER COMMON 



//NEWS SCROLLER
/*var delayb4scroll1=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed1=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit1=1 //Pause marquee onMousever (0=no. 1=yes)?

var copyspeed1=marqueespeed1
var pausespeed1=(pauseit1==0)? copyspeed1: 0
var actualheight1=''

function initializenewsmarquee(){
cross_newsmarquee=document.getElementById("nvmarquee")
if(cross_newsmarquee!=null)
{
    cross_newsmarquee.style.top=0;
}
marqueeheight1=document.getElementById("newsmarqueecontainer").offsetHeight
actualheight1=cross_newsmarquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_newsmarquee.style.height=marqueeheight1+"px"
cross_newsmarquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollnewsmarquee()",30)', delayb4scroll1)
}

function scrollnewsmarquee(){
if (parseInt(cross_newsmarquee.style.top)>(actualheight1*(-1)+8))
cross_newsmarquee.style.top=parseInt(cross_newsmarquee.style.top)-copyspeed1+"px"
else
cross_newsmarquee.style.top=parseInt(marqueeheight1)+8+"px"
}
*/
//NEWS SCROLLER


 // Functon : OpenWin
 // Purpose :For opening popup window on help
 // Created By Dharmesh
 // Dated : 18/04/07
function OpenWin(filename)
{
	var myWinLeft = (screen.width-700)/2;
    var myWinTop = (screen.height-600)/2;
	var myWin=window.open(filename,'popupwindow','left='+ myWinLeft +',top='+ myWinTop +',scrollbars=yes,height=600,width=700,resizable=no');
	myWin.focus();
}




function chkTextAreaLength(element,maxlen)
{
    var ReturnValue;
    ReturnValue=true;
    var str	=	element.value;
    var maximumlength	=	parseInt(maxlen);
    if(element.value.length > parseInt(maxlen))
    {
	    element.value	=	str.substring(0,maximumlength);
	    alert("Only "+maxlen +" characters are allowed.");
	    ReturnValue=false;
    }
    return ReturnValue;
    
}


function CheckTextBoxLength(element,maxlen)
{
    var IsOK;
    IsOK=true;
    var str	=	element.value;
    var maximumlength	=	parseInt(maxlen);
    if(element.value.length > parseInt(maxlen))
    {
	    element.value	=	str.substring(0,maximumlength);
	    alert("Only "+maxlen +" characters are allowed.");
	    IsOK=false;
    }
    return IsOK;
    
}
function CheckAll(chkAll,chkMon,chkTue,chkWed,chkThu,chkFri,chkSat,chkSun)
{
    var chkAll = document.getElementById(chkAll);
    var chkMon = document.getElementById(chkMon);
    var chkTue = document.getElementById(chkTue);
    var chkWed = document.getElementById(chkWed);
    var chkThu = document.getElementById(chkThu);
    var chkFri = document.getElementById(chkFri);
    var chkSat = document.getElementById(chkSat);
    var chkSun = document.getElementById(chkSun);
    
    if (chkAll.checked == true)
    {
        chkMon.checked = true;
        chkTue.checked = true;
        chkWed.checked = true;
        chkThu.checked = true;
        chkFri.checked = true;
        chkSat.checked = true;
        chkSun.checked = true;
    }
    else
    {
        chkMon.checked = false;
        chkTue.checked = false;
        chkWed.checked = false;
        chkThu.checked = false;
        chkFri.checked = false;
        chkSat.checked = false;
        chkSun.checked = false;
    }
    
    return true;
}

function UnCheckOnlyAll(chkAll,chk)
{
    var chkAll = document.getElementById(chkAll);
    var chk1 = document.getElementById(chk);
    
    if (chk1.checked == false)
    {
        chkAll.checked = false;
    }
    return true;
}

function CheckForAllDays(chkAll,chkPeak,chkOffPeak,chkMon,chkTue,chkWed,chkThu,chkFri,chkSat,chkSun)
{  
    var chkAll = document.getElementById(chkAll);
    var chkPeak = document.getElementById(chkPeak);
    var chkOffPeak = document.getElementById(chkOffPeak);
    var chkMon = document.getElementById(chkMon);
    var chkTue = document.getElementById(chkTue);
    var chkWed = document.getElementById(chkWed);
    var chkThu = document.getElementById(chkThu);
    var chkFri = document.getElementById(chkFri);
    var chkSat = document.getElementById(chkSat);
    var chkSun = document.getElementById(chkSun);
    
    if (chkAll.checked == true)
    {
        chkPeak.checked = true;
        chkOffPeak.checked = true;
        chkMon.checked = true;
        chkTue.checked = true;
        chkWed.checked = true;
        chkThu.checked = true;
        chkFri.checked = true;
        chkSat.checked = true;
        chkSun.checked = true;
    }
    else
    {
        chkPeak.checked = false;
        chkOffPeak.checked = false;
        chkMon.checked = false;
        chkTue.checked = false;
        chkWed.checked = false;
        chkThu.checked = false;
        chkFri.checked = false;
        chkSat.checked = false;
        chkSun.checked = false;
    }
    
    return true;
}


// to Lock the alfabets and special charcters
// Dated 03/21/07
// Created By Ashish
function CheckKeyPress(e)
{  
//     alert('hi');
//	evt = (evt) ? evt : ((event) ? event : null);
//	var charCode = (evt.charCode) ? evt.charCode : evt.keyCode
//			
//	if(charCode == 13)
//	{  
//		return true;
//    }
//	else
//	{
//		return false;
//	}
alert("Key Pressed: " + String.fromCharCode(e.charCode) + "\n"
      + "charCode: " + e.charCode);

}



function CheckNum(obj,evt)
{  
   
	evt = (evt) ? evt : ((event) ? event : null);
	var charCode = (evt.charCode) ? evt.charCode : evt.keyCode
	
	
	if( ((charCode >= 48) && (charCode <= 57)) || ((charCode >= 96) && (charCode <= 105)) || (charCode == 8)|| (charCode == 13) || (charCode == 9) || (charCode == 35) || (charCode == 36))
	{  
		return true;
    }
	else
	{
		return false;
	}
}

function CheckFloatNum(obj,evt)
{
evt = (evt) ? evt : ((event) ? event : null);
	var charCode = (evt.charCode) ? evt.charCode : evt.keyCode
//	alert(charCode);
	if( ((charCode >= 48) && (charCode <= 57)) || ((charCode >= 96) && (charCode <= 105)) || (charCode == 8)|| (charCode == 13) || (charCode == 9) || (charCode == 46) || (charCode == 190) || (charCode == 35) || (charCode == 36) || (charCode == 110))
	{
	
		return true;
	}
	else
		return false;
}

function CheckNumber(obj,evt)
{
    evt = (evt) ? evt : ((event) ? event : null);
	var charCode = (evt.charCode) ? evt.charCode : evt.keyCode
	if( ((charCode >= 48) && (charCode <= 57)) || ((charCode >= 96) && (charCode <= 105)) || (charCode == 8)|| (charCode == 13) || (charCode == 9) || (charCode == 46) || (charCode == 35) || (charCode == 36) || (charCode == 110))
	{
		return true;
	}
	else
		return false;
}

//function Name : FillSameMemberContactValue
// Dated 18/06/2007
// Created By Girish Sharma
//Fill the same Country Wise Contact values in the corresponding fields
 
function FillSameMemberContactValue(status,MemberName,Name,MemberEmail,Email,MemberFax,Fax,MemberPhone,Phone)
{   
    
    if (status.checked)
    {
        document.getElementById(MemberName).value = document.getElementById(Name).value;
        document.getElementById(MemberEmail).value = document.getElementById(Email).value;
        document.getElementById(MemberFax).value = document.getElementById(Fax).value;
        document.getElementById(MemberPhone).value = document.getElementById(Phone).value;
    }
    else
    {
        document.getElementById(MemberName).value = '';
        document.getElementById(MemberEmail).value = '';
        document.getElementById(MemberFax).value = '';
        document.getElementById(MemberPhone).value = '';
    }
} 

// Created By Ashish Kumar Srivastava
// Purpose for date compare
// 27/06/07

function DateCompare(source, arguments)
{      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtDateFrom")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("txtBookedEndDate")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
	//var strDateFrom;
	//strDateFrom = document.getElementById(txtDateFrom).value;
	var FromDate = strDateFrom.split('/');
	fromYear 	 = FromDate[2];
	fromMonth	 = FromDate[1];
	fromDate	 = FromDate[0];

	//var strDateTo;
	//strDateTo = document.getElementById(txtDateTo).value;
	var ToDate = strDateTo.split('/');
	toYear 	 = ToDate[2];
	toMonth	 = ToDate[1];
	toDate	 = ToDate[0];

    if(toYear > fromYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(toYear < fromYear)
    {
        //alert('From Date must be greater than or equal to To Date');
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(toMonth > fromMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }	

	    else if(toMonth < fromMonth)
	    {
		    //alert('From Date must be greater than or equal to To Date');
		    arguments.IsValid = false;
            return false;
	    }	
	    else
	    {
		    if(toDate > fromDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else		    
		    {   //alert('From Date must be greater than or equal to To Date');
		       arguments.IsValid = false;
                return false;
		    }
    		
	    }
    }
}

// Created By Ashish Kumar Srivastava
// Purpose for date compare
// 27/06/07

function DateCompareValidBookedDate(source, arguments)
{      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtValidStartDate")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("txtValidEndDate")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
	//var strDateFrom;
	//strDateFrom = document.getElementById(txtDateFrom).value;
	var FromDate = strDateFrom.split('/');
	fromYear 	 = FromDate[2];
	fromMonth	 = FromDate[1];
	fromDate	 = FromDate[0];

	//var strDateTo;
	//strDateTo = document.getElementById(txtDateTo).value;
	var ToDate = strDateTo.split('/');
	toYear 	 = ToDate[2];
	toMonth	 = ToDate[1];
	toDate	 = ToDate[0];

    if(toYear > fromYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(toYear < fromYear)
    {
        //alert('From Date must be greater than or equal to To Date');
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(toMonth > fromMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }	

	    else if(toMonth < fromMonth)
	    {
		    //alert('From Date must be greater than or equal to To Date');
		    arguments.IsValid = false;
            return false;
	    }	
	    else
	    {
		    if(toDate > fromDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else		    
		    {   //alert('From Date must be greater than or equal to To Date');
		       arguments.IsValid = false;
                return false;
		    }
    		
	    }
    }
}


// Created By   : Girish Sharma
// Purpose      : Compare "Can be Booked Date" and "Valid Date(Start Date) for Bookings"
//              : "Valid Date(Start Date) for Bookings" Must be Grater Then or Equal to the "Can be Booked Date"
// Module       : Super/OfferList
// Create Date  : 20/09/07

function DateCompareStartDateWithCanbeBookeddate(source, arguments)
{      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtDateFrom")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("txtValidStartDate")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
         
	        var FromDate = strDateFrom.split('/');
	        fromYear 	 = FromDate[2];
	        fromMonth	 = FromDate[1];
	        fromDate	 = FromDate[0];

	        var ToDate = strDateTo.split('/');
	        toYear 	 = ToDate[2];
	        toMonth	 = ToDate[1];
	        toDate	 = ToDate[0];

            if(toYear > fromYear)
            {
                arguments.IsValid = true;
                return true;
            }
            else if(toYear < fromYear)
            {
                //alert('From Date must be greater than or equal to To Date');
                arguments.IsValid = false;
                return false;
            }
            else
            {
	            if(toMonth > fromMonth)
	            {
		           arguments.IsValid = true;
                   return true;
	            }	

	            else if(toMonth < fromMonth)
	            {
		            //alert('From Date must be greater than or equal to To Date');
		            arguments.IsValid = false;
                    return false;
	            }	
	            else
	            {
		            if(toDate >= fromDate)
		            { 
		                arguments.IsValid = true;
                        return true;
		            }
		            else		    
		            {   //alert('From Date must be greater than or equal to To Date');
		               arguments.IsValid = false;
                        return false;
		            }
            		
	            }
            }
}

// Created By   : Girish Sharma
// Purpose      : Compare "Can be Booked Date" and "Valid Date (End Date) for Bookings"
//              : "Valid Date(End Date) for Bookings" Must be Grater Then or Equal to the "Can be Booked Date"
// Module       : Super/OfferList
// Create Date  : 20/09/07

function DateCompareEndDateWithCanbeBookeddate(source, arguments)
{      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtDateFrom")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("txtValidEndDate")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
         
	        var FromDate = strDateFrom.split('/');
	        fromYear 	 = FromDate[2];
	        fromMonth	 = FromDate[1];
	        fromDate	 = FromDate[0];

	        var ToDate = strDateTo.split('/');
	        toYear 	 = ToDate[2];
	        toMonth	 = ToDate[1];
	        toDate	 = ToDate[0];

            if(toYear > fromYear)
            {
                arguments.IsValid = true;
                return true;
            }
            else if(toYear < fromYear)
            {
                //alert('From Date must be greater than or equal to To Date');
                arguments.IsValid = false;
                return false;
            }
            else
            {
	            if(toMonth > fromMonth)
	            {
		           arguments.IsValid = true;
                   return true;
	            }	

	            else if(toMonth < fromMonth)
	            {
		            //alert('From Date must be greater than or equal to To Date');
		            arguments.IsValid = false;
                    return false;
	            }	
	            else
	            {
		            if(toDate >= fromDate)
		            { 
		                arguments.IsValid = true;
                        return true;
		            }
		            else		    
		            {   //alert('From Date must be greater than or equal to To Date');
		               arguments.IsValid = false;
                        return false;
		            }
            		
	            }
            }
}

// Created By : Ashish Kumar Srivastava
// Purpose :   To enable disable EnableDisableProperty
// Function : EnableDisableProperty()

function EnableDisableProperty(rbcontrolId)
{   
}

function CheckAllDataGridProduct(aspCheckBoxID, checkVal)
 {   
 
        for(i = 0; i < document.forms[0].elements.length; i++) {

            elm = document.forms[0].elements[i]
           
            if (elm.type == 'checkbox') 
            {
                var published = elm.name.substr(elm.name.lastIndexOf("$")+1);
                if(published==aspCheckBoxID)
                 {  
                    elm.checked = checkVal

                }
            }
        }
    }
    
    function  CheckTreeViewCheckBox(source, arguments)
    {   
 
       var blnChecked=false;
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'checkbox') 
            { 
                if(elm.name.indexOf("tvNevigation")>0)
                { 
                   if(elm.checked == true)
                   {   
                    arguments.IsValid = true;
                    return true;
                   }
                }
            }
         }
        if(blnChecked==false)
        {
            //alert('Product Category must be Selected.');
            arguments.IsValid = false;
            return false;
        }
    }
        
 
function DateCompareAddeditPoll(source, arguments)
    {      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtstartDate")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("txtenddate")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
	//var strDateFrom;
	//strDateFrom = document.getElementById(txtDateFrom).value;
	var FromDate = strDateFrom.split('/');
	fromYear 	 = FromDate[2];
	fromMonth	 = FromDate[1];
	fromDate	 = FromDate[0];

	//var strDateTo;
	//strDateTo = document.getElementById(txtDateTo).value;
	var ToDate = strDateTo.split('/');
	toYear 	 = ToDate[2];
	toMonth	 = ToDate[1];
	toDate	 = ToDate[0];

    if(toYear > fromYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(toYear < fromYear)
    {
        //alert('From Date must be greater than or equal to To Date');
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(toMonth > fromMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }	

	    else if(toMonth < fromMonth)
	    {
		    //alert('From Date must be greater than or equal to To Date');
		    arguments.IsValid = false;
            return false;
	    }	
	    else
	    {
		    if(toDate >= fromDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else		    
		    {   //alert('From Date must be greater than or equal to To Date');
		       arguments.IsValid = false;
                return false;
		    }
    		
	    }
    }
}


function DateCompareLogolist(source, arguments)
{      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtactivationDate")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("txtexpirydate")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
         
   if(strDateTo.length >0) 
	{
	//var strDateFrom;
	//strDateFrom = document.getElementById(txtDateFrom).value;
	var FromDate = strDateFrom.split('/');
	fromYear 	 = FromDate[2];
	fromMonth	 = FromDate[1];
	fromDate	 = FromDate[0];

	//var strDateTo;
	//strDateTo = document.getElementById(txtDateTo).value;
	var ToDate = strDateTo.split('/');
	toYear 	 = ToDate[2];
	toMonth	 = ToDate[1];
	toDate	 = ToDate[0];

    if(toYear > fromYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(toYear < fromYear)
    {
        //alert('From Date must be greater than or equal to To Date');
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(toMonth > fromMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }	

	    else if(toMonth < fromMonth)
	    {
		    //alert('From Date must be greater than or equal to To Date');
		    arguments.IsValid = false;
            return false;
	    }	
	    else
	    {
		    if(toDate >= fromDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else		    
		    {   //alert('From Date must be greater than or equal to To Date');
		       arguments.IsValid = false;
                return false;
		    }
    		
	    }
    }
   }
   else
   {
            
             arguments.IsValid = true;
                return true;
                
   
   
   }
}

// Create By  : Girish Sharma
// Create Date : 30-07-2007
// Module : VacanciesList
function DateCompareVacanciesList(source, arguments)
{      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("EBizTxtDisplayFrom")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("EBizTxtDisplayTo")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
	//var strDateFrom;
	//strDateFrom = document.getElementById(txtDateFrom).value;
	var FromDate = strDateFrom.split('/');
	fromYear 	 = FromDate[2];
	fromMonth	 = FromDate[1];
	fromDate	 = FromDate[0];

	//var strDateTo;
	//strDateTo = document.getElementById(txtDateTo).value;
	var ToDate = strDateTo.split('/');
	toYear 	 = ToDate[2];
	toMonth	 = ToDate[1];
	toDate	 = ToDate[0];

    if(toYear > fromYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(toYear < fromYear)
    {
        //alert('From Date must be greater than or equal to To Date');
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(toMonth > fromMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }	

	    else if(toMonth < fromMonth)
	    {
		    //alert('From Date must be greater than or equal to To Date');
		    arguments.IsValid = false;
            return false;
	    }	
	    else
	    {
		    if(toDate >= fromDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else		    
		    {   //alert('From Date must be greater than or equal to To Date');
		       arguments.IsValid = false;
                return false;
		    }
    		
	    }
    }
}



// Create By  : Girish Sharma
// Create Date : 30-07-2007
// Module : Advertisement

function DateCompareAdvertisement(source, arguments)
{      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("EBizTxtDisplayFrom")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("EBizTxtExpiryDate")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
	//var strDateFrom;
	//strDateFrom = document.getElementById(txtDateFrom).value;
	var FromDate = strDateFrom.split('/');
	fromYear 	 = FromDate[2];
	fromMonth	 = FromDate[1];
	fromDate	 = FromDate[0];

	//var strDateTo;
	//strDateTo = document.getElementById(txtDateTo).value;
	var ToDate = strDateTo.split('/');
	toYear 	 = ToDate[2];
	toMonth	 = ToDate[1];
	toDate	 = ToDate[0];

    if(toYear > fromYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(toYear < fromYear)
    {
        //alert('From Date must be greater than or equal to To Date');
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(toMonth > fromMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }	

	    else if(toMonth < fromMonth)
	    {
		    //alert('From Date must be greater than or equal to To Date');
		    arguments.IsValid = false;
            return false;
	    }	
	    else
	    {
		    if(toDate >= fromDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else		    
		    {   //alert('From Date must be greater than or equal to To Date');
		       arguments.IsValid = false;
                return false;
		    }
    		
	    }
    }
}


function DateCompareNewsLetter(source, arguments)
{      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtstartDate")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("txtenddate")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
	//var strDateFrom;
	//strDateFrom = document.getElementById(txtDateFrom).value;
	var FromDate = strDateFrom.split('/');
	fromYear 	 = FromDate[2];
	fromMonth	 = FromDate[1];
	fromDate	 = FromDate[0];

	//var strDateTo;
	//strDateTo = document.getElementById(txtDateTo).value;
	var ToDate = strDateTo.split('/');
	toYear 	 = ToDate[2];
	toMonth	 = ToDate[1];
	toDate	 = ToDate[0];

    if(toYear > fromYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(toYear < fromYear)
    {
        //alert('From Date must be greater than or equal to To Date');
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(toMonth > fromMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }	

	    else if(toMonth < fromMonth)
	    {
		    //alert('From Date must be greater than or equal to To Date');
		    arguments.IsValid = false;
            return false;
	    }	
	    else
	    {
		    if(toDate >= fromDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else		    
		    {   //alert('From Date must be greater than or equal to To Date');
		       arguments.IsValid = false;
                return false;
		    }
    		
	    }
    }
}

// Create By : Girish Sharma
// Module : Group/GroupBookingSetting.aspx
// Purpose : to Check Minimum and Maximum Age Comparsion

function AgeCompareBookingSettings(source, arguments)
{      
      var chkAgeRestriction=document.getElementById('ctl00_ctn1_chkAgeRestriction');
      var intMinAge='';
      var intMaxAge='';
      
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtMinAge")>0)
                { 
                    intMinAge=elm.value;
                }
                
                 if(elm.name.indexOf("txtMaxAge")>0)
                {  
                    intMaxAge=elm.value;
                }
            }
         }
         
         
	if(chkAgeRestriction.checked && intMaxAge.length >0 && intMinAge.length >0)
	    {   
	        if(parseInt(intMaxAge) > parseInt(intMinAge))
	        {
	            arguments.IsValid = true;
                return true;
	        }
            else
            {
                arguments.IsValid = false;
                return false;
            } 
       }
       else
       {
            arguments.IsValid = true;
                return true;
       }
}

// Function : IsRequireMinAgeBookingSettings
// Create By : Girish Sharma
// Module : Group/GroupBookingSetting.aspx
// Purpose : to IsRequire Minimum Age

function IsRequireMinAgeBookingSettings(source, arguments)
{     
      var intMinAge='';
      var intMaxAge='';
      var chkAgeRestriction=document.getElementById('ctl00_ctn1_chkAgeRestriction');
      
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtMinAge")>0)
                { 
                    intMinAge=elm.value;
                }
                
                 if(elm.name.indexOf("txtMaxAge")>0)
                {  
                    intMaxAge=elm.value;
                }
            }
         }
          
            if(chkAgeRestriction.checked)
            {
                 if(intMinAge.length ==0)
                 {  
                    arguments.IsValid = false;
                        return false;
                 }
             }    
}

// Function : IsRequireMaxAgeBookingSettings
// Create By : Girish Sharma
// Module : Group/GroupBookingSetting.aspx
// Purpose : to IsRequire Maximum Age
function IsRequireMaxAgeBookingSettings(source, arguments)
{     
      var intMinAge='';
      var intMaxAge='';
      var chkAgeRestriction=document.getElementById('ctl00_ctn1_chkAgeRestriction');
      
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtMinAge")>0)
                { 
                    intMinAge=elm.value;
                }
                
                 if(elm.name.indexOf("txtMaxAge")>0)
                {  
                    intMaxAge=elm.value;
                }
            }
         }
          
            if(chkAgeRestriction.checked)
            {
                 if(intMaxAge.length ==0)
                 {  
                    arguments.IsValid = false;
                        return false;
                 }
             }    
}


// GeneralSetting (NormalBookingSettings)
// Function : AgeCompareGeneralSettings    
// Create By : Girish Sharma
// Module : Group/GroupBookingSetting.aspx
// Purpose : to Check Minimum and Maximum Age Comparsion

function AgeCompareGeneralSettings(source, arguments)
{      
      var chkAgeRestriction=document.getElementById('ctl00_ctn1_chkAgeRestriction');
      var intMinAge='';
      var intMaxAge='';
      
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtMinAge")>0)
                { 
                    intMinAge=elm.value;
                }
                
                 if(elm.name.indexOf("txtMaxAge")>0)
                {  
                    intMaxAge=elm.value;
                }
            }
         }
         
         
	if(chkAgeRestriction.checked && intMaxAge.length >0 && intMinAge.length >0)
	    {   
	        if(parseInt(intMaxAge) > parseInt(intMinAge))
	        {  
	            arguments.IsValid = true;
                return true;
	        }
            else
            {  
                arguments.IsValid = false;
                return false;
            } 
       }
       else
       {
            arguments.IsValid = true;
                return true;
       }
}

// Function : IsRequireMinAgeGeneralSettings
// Create By : Girish Sharma
// Module : Group/NormalBookingSetting.aspx
// Purpose : to IsRequire Minimum Age

function IsRequireMinAgeGeneralSettings(source, arguments)
{     
      var intMinAge='';
      var intMaxAge='';
      var chkAgeRestriction=document.getElementById('ctl00_ctn1_chkAgeRestriction');
      
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtMinAge")>0)
                { 
                    intMinAge=elm.value;
                }
                
                 if(elm.name.indexOf("txtMaxAge")>0)
                {  
                    intMaxAge=elm.value;
                }
            }
         }
          
            if(chkAgeRestriction.checked)
            {
                 if(intMinAge.length ==0)
                 {  
                    arguments.IsValid = false;
                        return false;
                 }
             }    
}

// Function : IsRequireMaxAgeGeneralSettings
// Create By : Girish Sharma
// Module : Group/NormalBookingSetting.aspx
// Purpose : to IsRequire Maximum Age
function IsRequireMaxAgeGeneralSettings(source, arguments)
{     
      var intMinAge='';
      var intMaxAge='';
      var chkAgeRestriction=document.getElementById('ctl00_ctn1_chkAgeRestriction');
      
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtMinAge")>0)
                { 
                    intMinAge=elm.value;
                }
                
                 if(elm.name.indexOf("txtMaxAge")>0)
                {  
                    intMaxAge=elm.value;
                }
            }
         }
          
            if(chkAgeRestriction.checked)
            {
                 if(intMaxAge.length ==0)
                 {  
                    arguments.IsValid = false;
                        return false;
                 }
             }    
}



//

function EnableDisableExtraCost(rbId,txtId)
{
    var rabid= document.getElementById(rbId);
    var txtid= document.getElementById(txtId);
    
    if(rabid.checked==true)
    {  
        txtid.disabled = false;
    }
    else
    { 
        txtid.disabled = true;
    }
    
}

//Create By : Ashish Kumar Srivastava
// Create Date : 08-08-2007
// Module : Property admin(New registered Property)

function CheckChain(source, arguments)
{

//var ReturnValue=false;
//    var checkCode=document.getElementById('ctl00_ctn1_chkIsChain');
//    var ddlPropertyCode= document.getElementById('ctl00_ctn1_ddlPropertyChaincode');
//    var txtChaincode= document.getElementById('ctl00_ctn1_txtChainCode');
//    if(checkCode.checked)
//    {
//     if(ddlPropertyCode.value != '-Select Chain Code-' || txtChaincode.value!='')
//        {
//          ReturnValue=true;
//          arguments.IsValid = true;
//         }
//         else
//         {
//          ReturnValue=false;
//          arguments.IsValid = false;
//         }
//    }
//    else
//    {
//        
//    ReturnValue=true;
//    arguments.IsValid = true;
//       
//    }
//          
//    return ReturnValue;

}

function ToCheckChainBox(source, arguments)
{

    var ReturnValue=false;
    var checkCode=document.getElementById('ctl00_ctn1_chkIsChain');
    var ddlPropertyCode= document.getElementById('ctl00_ctn1_ddlPropertyChaincode');
    var txtChaincode= document.getElementById('ctl00_ctn1_txtChainCode');
     
    if(checkCode.checked)
    {           
        if(ddlPropertyCode.value == 0)
        {   
            if(txtChaincode.value == '')
                   {            
                      ReturnValue=false;
                      arguments.IsValid = false;
                   }                   
            else
                {
                   ReturnValue=true;
                   arguments.IsValid = true;                
                }   
         }
         else 
         {
              ReturnValue=true;
              arguments.IsValid = true;
           
          }       
    }   
    
    return ReturnValue;
}

// Created By Ashish For Offers
// Created Date 09/08/2007

function ChangeOfferType(ddlOfferType,pnlFixedPriceOffer,pnlFreeNights,pnlDiscount,pnlFreeUpgrade,pnlFreeMerchandise,pnlisminnightrequired,pnlisminpricerequired,pnlisminpeoplerequired)
{
    // offer Type
    var ddlOfferType=document.getElementById(ddlOfferType);
    var pnlFixedPriceOffer=document.getElementById(pnlFixedPriceOffer);
    var pnlFreeNights= document.getElementById(pnlFreeNights);
    var pnlDiscount= document.getElementById(pnlDiscount);
    var pnlFreeUpgrade= document.getElementById(pnlFreeUpgrade);
    var pnlFreeMerchandise= document.getElementById(pnlFreeMerchandise);
    var pnlchkisminnight = document.getElementById(pnlisminnightrequired);
    var pnlchkisminprice = document.getElementById(pnlisminpricerequired);
    var pnlchkisminpeople = document.getElementById(pnlisminpeoplerequired);
    
    // to hide the panels
    
    if (pnlFixedPriceOffer != null)
        pnlFixedPriceOffer.style.display = "none";
           
    if (pnlFreeNights != null)
        pnlFreeNights.style.display = "none";
        
    if (pnlDiscount != null)
        pnlDiscount.style.display = "none";
        
    if (pnlFreeUpgrade != null)
        pnlFreeUpgrade.style.display = "none";
        
    if (pnlFreeMerchandise != null)
        pnlFreeMerchandise.style.display = "none";
        
    if (pnlchkisminnight != null)
        pnlchkisminnight.style.display = "none";
        
    if (pnlchkisminprice != null)
        pnlchkisminprice.style.display = "none";
        
    if (pnlchkisminpeople != null)
        pnlchkisminpeople.style.display = "none";
    
    // to show the panel  according to Offer type selected.
    if (ddlOfferType != null)
    {
    switch(ddlOfferType.value)
    {
        case '1':
        pnlFixedPriceOffer.style.display = "";
        if(pnlchkisminnight!=null)
        {
        pnlchkisminnight.style.display = "";
        }
        pnlchkisminpeople.style.display = "";
        break;
        
        case '2':
        pnlFreeNights.style.display = "";
        if(pnlchkisminnight!=null)
        {
        pnlchkisminnight.style.display = "";
        }
        pnlchkisminprice.style.display = "";
        break;
        
        case '3':
        pnlDiscount.style.display = "";
        if(pnlchkisminnight!=null)
        {
        pnlchkisminnight.style.display = "";
        }
        pnlchkisminprice.style.display = "";
        pnlchkisminpeople.style.display = "";
        break;
        
        case '4':
        pnlFreeUpgrade.style.display = "";
        if(pnlchkisminnight!=null)
        {
        pnlchkisminnight.style.display = "";
        }
        pnlchkisminprice.style.display = "";
        pnlchkisminpeople.style.display = "";
        break;
        
        case '5':
        pnlFreeMerchandise.style.display = "";
        if(pnlchkisminnight!=null)
        {
        pnlchkisminnight.style.display = "";
        }
        pnlchkisminprice.style.display = "";
        pnlchkisminpeople.style.display = "";
        break;
        
     }
    }


}

function ShowHideOtherPanelOffer(pnlMinNights,pnlMinPrice,pnlMinPeople,pnlLimitCount,pnlAllGroup,pnlParticularHostel,pnlParticularRomType,ddlApplicableTo,rbIsLimited,chkIsMinPeopleRequired,chkIsMinPriceRequired,chkIsMinNightRequired,rbDiscountType,pnlDiscountAmount,pnlDiscountPercentage)
{  
    var pnlMinNights=document.getElementById(pnlMinNights);
    var pnlMinPrice=document.getElementById(pnlMinPrice);
    var pnlMinPeople= document.getElementById(pnlMinPeople);
    var pnlLimitCount= document.getElementById(pnlLimitCount);
    var pnlAllGroup= document.getElementById(pnlAllGroup);
    var pnlParticularHostel= document.getElementById(pnlParticularHostel);
    var pnlParticularRomType= document.getElementById(pnlParticularRomType);
    var ddlApplicableTo= document.getElementById(ddlApplicableTo);
    //var rbIsLimited= document.getElementById(rbIsLimited);
    var chkIsMinPeopleRequired= document.getElementById(chkIsMinPeopleRequired);
    var chkIsMinPriceRequired= document.getElementById(chkIsMinPriceRequired);
    var chkIsMinNightRequired= document.getElementById(chkIsMinNightRequired);
    
    var rbDiscountType= document.getElementById(rbDiscountType+'_1');
    var pnlDiscountAmount= document.getElementById(pnlDiscountAmount);
    var pnlDiscountPercentage= document.getElementById(pnlDiscountPercentage);
       var rbIsLimited0= document.getElementById(rbIsLimited+'_0');
        var rbIsLimited1= document.getElementById(rbIsLimited+'_1');
       
       if (rbDiscountType != null)
       {
         if(rbDiscountType.checked)
         {
             pnlDiscountAmount.style.display = "none";
             pnlDiscountPercentage.style.display = "";
         }
        else
         {
             pnlDiscountAmount.style.display = "";
             pnlDiscountPercentage.style.display = "none";
           
         }
        }
       
       if (rbIsLimited1 != null)
       {
        if(rbIsLimited1.checked)
            pnlLimitCount.style.display = "";
        else
            pnlLimitCount.style.display = "none";
        }
         

        if (chkIsMinNightRequired != null)
        {
        if(chkIsMinNightRequired.checked)
            {
                pnlMinNights.style.display = "";
            }
         else
          { 
            pnlMinNights.style.display = "none";
           }
        }
              
        if (chkIsMinPriceRequired != null)
        {
         if(chkIsMinPriceRequired.checked)
            pnlMinPrice.style.display = "";
         else
              pnlMinPrice.style.display = "none"; 
        }
              
        if (chkIsMinPeopleRequired != null)
        {
        if(chkIsMinPeopleRequired.checked)
            pnlMinPeople.style.display = "";
         else
              pnlMinPeople.style.display = "none";
        }
              
             
        if (pnlAllGroup != null)
            pnlAllGroup.style.display = "none"; 
            
         if (pnlParticularHostel != null)
            pnlParticularHostel.style.display = "none";
            
         if (pnlParticularRomType != null)
            pnlParticularRomType.style.display = "none"; 
       
       if (ddlApplicableTo != null)
       {
       switch(ddlApplicableTo.value)
       {
           case '1':
                pnlAllGroup.style.display = "";
                break;
            case '2':
                break;
            case '3':
                pnlParticularHostel.style.display = "";
                break;
            case '4':
                break;
            case '5':
                pnlParticularRomType.style.display = "";
                break;
        }
        }
}
       
function IsMinimumNigthChecked(chkMinimumNigths)
{
     var IsTrue= document.getElementById(chkMinimumNigths);
     var  MinimumNigths= document.getElementById('ctl00_ctn1_ctrlOffers_txtMinNights');
    
     if(IsTrue.checked ==false)
     {
        if(MinimumNigths != null)
        {
            MinimumNigths.value=0;
        }
     }
}

function IsMinimumPeopleChecked(chkMinimumPeople)
{
     var IsTrue= document.getElementById(chkMinimumPeople);
     var  MinimumPeople= document.getElementById('ctl00_ctn1_ctrlOffers_txtMinPeople');
    
     if(IsTrue.checked ==false)
     {
        if(MinimumPeople != null)
        {
            MinimumPeople.value=0;
        }
     }
}

function IsMinimumPriceChecked(chkMinimumPrice)
{
     var IsTrue= document.getElementById(chkMinimumPrice);
     var  MinimumPrice= document.getElementById('ctl00_ctn1_ctrlOffers_txtMinPrice');
    
     if(IsTrue.checked ==false)
     {
        if(MinimumPrice != null)
        {
            MinimumPrice.value=0;
        }
     }
}
       
  function EnableDisableMarkupvalue(status,txtmarkupId,txtconversionid)
{    
    if(document.getElementById(status).checked)
    {  
        document.getElementById(txtconversionid).value ='1.00'; 
        document.getElementById(txtmarkupId).value ='0.00';
        document.getElementById(txtconversionid).disabled = true;        
        document.getElementById(txtmarkupId).disabled = true;        
        
    }
    else
    {
        document.getElementById(txtconversionid).value = ''; 
        document.getElementById(txtmarkupId).value  ='';   
        document.getElementById(txtconversionid).disabled  = false;
        document.getElementById(txtmarkupId).disabled = false;        
    }    
}


function IsRequirCurrencyMarkup(source, arguments)
{     
          
         var chkid =document.getElementById('ctl00_ctn1_chkisbaserate');         
         var txtmarkup = document.getElementById('ctl00_ctn1_txtmarkup');
         
        var TxtmarkupLength='';
       
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtmarkup")>0)
                { 
                
                    TxtmarkupLength=elm.value;
                }
            }
         }         
         
         if(chkid.checked)
         {  
            
            arguments.IsValid = true;            
            return true;
            
         }
         else
         {  
                if(TxtmarkupLength.length >0)
                 {             
                            arguments.IsValid = true;                                      
                            return true;
                             
                 }
                 else 
                    {           
                        arguments.IsValid = false;                            
                        return false;
                        
                    }  
                    
}  
}


function OnLoadcurrency(status,txtmarkupId,txtconversionid)
{
if(document.getElementById(status).checked)
    {  
        document.getElementById(txtconversionid).disabled = true;        
        document.getElementById(txtmarkupId).disabled = true;
        alert('a');        
        document.getElementById(txtconversionid).value ='1.00'; 
        document.getElementById(txtmarkupId).value ='5.00';
    }
    else
    {
        document.getElementById(txtconversionid).disabled  = false;
        document.getElementById(txtmarkupId).disabled = false;
        document.getElementById(txtconversionid).value =''; 
        document.getElementById(txtmarkupId).value  ='';   
    }    

}



//function to enable or disable textboxes
function EnableDisableTextBoxes(ctrl,txtctrlid1,txtctrlid2)
{
    
    var tt = window.document.getElementById(ctrl);
    if(tt.checked == true)
    {
      
       window.document.getElementById(txtctrlid1).disabled=false; 
       window.document.getElementById(txtctrlid2).disabled=false;       
       window.document.getElementById(txtctrlid1).focus();
    } 
    else
    {
        window.document.getElementById(txtctrlid1).disabled=true; 
        window.document.getElementById(txtctrlid2).disabled=true;       
        window.document.getElementById(txtctrlid1).value='';       
        window.document.getElementById(txtctrlid2).value=''; 
    }   
}

//Function :CheckTreeViewCheckBoxCategory()
//Purpose:   To check only one category should check
//Created Date:  08/18/07

function CheckTreeViewCheckBoxCategory(source, arguments)
    {   
        var count=0;
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'checkbox') 
            { 
                if(elm.name.indexOf("tvNevigation")>0)
                { 
                   if(elm.checked == true)
                   {   
                   count=count+1;
                   }
                }
            }
         }
        if(count>1)
        {
            arguments.IsValid = false;
            return false;
        }
        else
        {
            arguments.IsValid = true;
            return true;
        
        }
    }
    
function viewpopupforadminsetting(url)
{

    var newwindow; 
    
    var w = 400;
    var h = 400;
    var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;

    var settings='width='+ w + ',height='+ h + ',top='+wint+',left='+winl+ ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,dependent=no';
    newwindow=window.open(url,'name1',settings);
    
    if (window.focus) {newwindow.focus();}
   return false;
} 


function viewpopupforpostcard(url)
{   
    window.location.href = url;
   return false;
} 

function ClientCallback(result, context)
{
      var childOrganizations = document.forms[0].elements['<%=ddlContactState.UniqueID%>'];
      if (!childOrganizations){
         return;
      }
      childOrganizations.length = 0;
      if (!result){
         return;
      }
      
      var rows = result.split('|'); 
      for (var i = 0; i < rows.length; ++i){
         var values = rows[i].split('^');
         var option = document.createElement("OPTION");
         option.value = values[0];
         option.innerHTML = values[1];     
         childOrganizations.appendChild(option);
      }
  }
   
   function ClientCallbackError(result, context)
   {
      alert(result);
   }
   
   function IsVatApplicable(source, arguments)
   {
        
        var txtvatno=document.getElementById('ctl00_ctn1_txtvat');            
        var chkvatapplicable=document.getElementById('ctl00_ctn1_chkIsvat');
          if(chkvatapplicable.checked)
                {               
                     if (txtvatno.value == '')
                     {       
                        arguments.IsValid = false;
                        return false;        
                    } 
                         
                    else 
                     {
                        arguments.IsValid = true;
                        return true;
                     }  
                }
   }
   
   
   
   
   function IsContractSignedfortxtSharedPeekWDPrice(source, arguments)
   {
        
        var txtSharedPeekWDPrice=document.getElementById('ctl00_ctn1_txtSharedPeekWDPrice');            
        var chkIsContractSigned=document.getElementById('ctl00_ctn1_chkIsContractSigned');
          if(chkIsContractSigned.checked)
                {               
                     if (txtSharedPeekWDPrice.value == '')
                     {       
                        arguments.IsValid = false;
                        return false;        
                    } 
                         
                    else 
                     {
                        arguments.IsValid = true;
                        return true;
                     }  
                }
   }
   
   
   function IsContractSignedtxtSharedPeakWEPrice(source, arguments)
   {
         var txtSharedPeakWEPrice=document.getElementById('ctl00_ctn1_txtSharedPeakWEPrice');
        var chkIsContractSigned=document.getElementById('ctl00_ctn1_chkIsContractSigned');
          if(chkIsContractSigned.checked)
                {               
                     if (txtSharedPeakWEPrice.value == '')
                     {       
                        arguments.IsValid = false;
                        return false;        
                     }         
                    else 
                     {
                        arguments.IsValid = true;
                        return true;
                     }  
                }
   }
   
   
function Monthonchange(ddlmonth,ddlyear,month,year)
{
    var ddlmonthid = document.getElementById(ddlmonth);
    var ddlyearid=  document.getElementById(ddlyear);

    if( parseInt(ddlyearid.value) == parseInt(year))
    {
        if( parseInt(ddlmonthid.value) <  parseInt(month))
        {
            alert("Card expiry date is Invalid.");
            //alert(ddlmonthid.value + ' ' + parseInt(month))
           ddlmonthid.selectedIndex=parseInt(month-1);
        }
    }
}
  
// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Advertisement List)

function ShowHideDestinationUrl(divpnlDropdownDestinationUrl,divpnlTxtDeDestinationUrl,radExternal,radInternal)
{
   var radInternal1=document.getElementById(radInternal);   
   var radExternal1= document.getElementById(radExternal);   
   var divpnlDropdownDestinationUrl1= document.getElementById(divpnlDropdownDestinationUrl);   
   var divpnlTxtDeDestinationUrl1=document.getElementById(divpnlTxtDeDestinationUrl); 
   var idWebExample1= document.getElementById('idWebExample');  
   var TxtDestinationUrl=document.getElementById('ctl00_ctn1_EBizTxtDestinationUrl');
 
 if(radInternal1 !=null && radExternal1 !=null)
 {  
     if(radInternal1.checked)
         {    
          divpnlTxtDeDestinationUrl1.style.display = "none";
          if(TxtDestinationUrl !=null)
          {
            TxtDestinationUrl.value='';
          }
          divpnlDropdownDestinationUrl1.style.display = ""; 
          idWebExample1.style.display = "none"; 
         }
        if(radExternal1.checked)
        {  
           divpnlTxtDeDestinationUrl1.style.display = "";
           divpnlDropdownDestinationUrl1.style.display = "none"; 
           idWebExample1.style.display = ""; 
        }        
  }
}

// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Advertisement List)
// For Internal Link
// Custom Validator
function IsRequirEBizTxtDestinationUrl(source, arguments)
{    
        var TxtDestinationUrl='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("EBizTxtDestinationUrl")>0)
                { 
                    TxtDestinationUrl=elm.value;
                }
            }
         }
         var radInternal=document.getElementById('ctl00_ctn1_radInternal');
         var radExternal=document.getElementById('ctl00_ctn1_radExternal');
      
         if(radInternal.checked)
         { 
            arguments.IsValid = true;
            return true;
         }
        else if(radExternal.checked)
         {
            if(TxtDestinationUrl.length >0)
            {
                arguments.IsValid = true;
                return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
                
         }
         else if(radInternal.checked)
         {
            arguments.IsValid = true;
            return true;
         }
}

// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Advertisement List)
// For External Link
// Custom Validator
function IsRequirddlDestinationUrl(source, arguments)
{     
         var ddlDestinationUrl=document.getElementById('ctl00_ctn1_ddlDestinationUrl');
         var radInternal=document.getElementById('ctl00_ctn1_radInternal');
         var radExternal=document.getElementById('ctl00_ctn1_radExternal');
     
         if(radExternal.checked && ddlDestinationUrl.value != -1)
         {  
            arguments.IsValid = true;
            return true;
         }
        if(radInternal.checked !=true)
         {
            arguments.IsValid = false;
            return false;
         }
}

// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Advertisement List)
// For Advertisement Text In Case of Advertisement Type is Text-Only
// Custom Validator
function IsRequirAdvertisementText(source, arguments)
{     
         var ddlAdvertisementType=document.getElementById('ctl00_ctn1_ddlAdvertisementType');
         var TxtAdvertisementText=document.getElementById('ctl00_ctn1_EBizTxtAdvertisementText');
         if(ddlAdvertisementType.value ==1 && TxtAdvertisementText.value.length >0)
         {  
            
            arguments.IsValid = true;
            return true;
         }
         if(ddlAdvertisementType.value ==1 && TxtAdvertisementText.value.length==0)
         {  
            arguments.IsValid = false;
            return false;
         }
}


// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Advertisement List)
// For Advertisement Image In Case of Advertisement Type is Static Or Animation
// Custom Validator
function IsRequirAdvertisementImage(source, arguments)
{     
         var ddlAdvertisementType=document.getElementById('ctl00_ctn1_ddlAdvertisementType');
         
          if (document.getElementById("ctl00_ctn1_hideenAdvImage").value == "" && document.getElementById("ctl00_ctn1_fuAdvertisementImage").value =="")
          {
          
            if(ddlAdvertisementType.value==1)
            {
                
                arguments.IsValid = true;
                return true;
            }
            else if(ddlAdvertisementType.value==2)
            {
                
                arguments.IsValid = false;
                return false;
            }
            else if(ddlAdvertisementType.value==3)
            {
               
                arguments.IsValid = false;
                return false;
            }
            else
            {
                
                arguments.IsValid = false;
                return false;
            }
           }
          else
          { 
                if(ddlAdvertisementType.value==2)
                {
                     if(document.getElementById("ctl00_ctn1_hideenAdvImage").value != "" && document.getElementById("ctl00_ctn1_fuAdvertisementImage").value =="")
                        {
                            
                            arguments.IsValid = true;
                            return true;
                        }
                       if(document.getElementById("ctl00_ctn1_hideenAdvImage").value != "" && document.getElementById("ctl00_ctn1_fuAdvertisementImage").value !="")
                        {  
                            arguments.IsValid = true;
                            return true;
                        }
                }
                if(ddlAdvertisementType.value==3)
                {
                    if(document.getElementById("ctl00_ctn1_hideenAdvImage").value != "" && document.getElementById("ctl00_ctn1_fuAdvertisementImage").value =="")
                        {
                            
                            arguments.IsValid = true;
                            return true;
                        }
                     if(document.getElementById("ctl00_ctn1_hideenAdvImage").value != "" && document.getElementById("ctl00_ctn1_fuAdvertisementImage").value !="")
                        {   
                            arguments.IsValid = true;
                            return true;
                        } 
                }
          }
}


// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Advertisement List)
// For Image Text In Case of Advertisement Type is Static Or Animation
// Custom Validator
function IsRequirImageText(source, arguments)
{     
         var ddlAdvertisementType=document.getElementById('ctl00_ctn1_ddlAdvertisementType');
         
         
         var TxtImageAltTextLength=document.getElementById("ctl00_ctn1_EBizTxtImageAltText").value.replace(/^\s*|\s(?=\s)|\s*$/g, "").length; 
         
          if (TxtImageAltTextLength== 0)
          {
          
            if(ddlAdvertisementType.value==1)
            {
                arguments.IsValid = true;
                return true;
            }
            else if(ddlAdvertisementType.value==2)
            {
                arguments.IsValid = false;
                return false;
            }
            else if(ddlAdvertisementType.value==3)
            {
                arguments.IsValid = false;
                return false;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
           }
          else
          { 
                if(ddlAdvertisementType.value==2)
                {
                     if(TxtImageAltTextLength != 0)
                        {
                           
                            arguments.IsValid = true;
                            return true;
                        }
                       if(TxtImageAltTextLength == 0)
                        {   
                            
                            arguments.IsValid = false;
                            return false;
                        }
                }
                if(ddlAdvertisementType.value==3)
                {
                    if(TxtImageAltTextLength != 0)
                        {
                            
                            arguments.IsValid = true;
                            return true;
                        }
                     if(TxtImageAltTextLength== 0)
                        {
                            
                            arguments.IsValid = false;
                            return false;
                        } 
                }
          }
}


// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Postcard Thumbnail)
// For Postcard Thumbnail Image
// Custom Validator
function IsRequirePostCardThumbnailImage(source, arguments)
{    

  if (document.getElementById("ctl00_ctn1_ctrlPostCard_HiddenThumbnailImage").value == "" && document.getElementById("ctl00_ctn1_ctrlPostCard_fuCardTumbnail").value =="")
  {
       arguments.IsValid = false;
        return false;
        
   }
  else
  { 
          arguments.IsValid = true;
            return true;
      
  }
}



// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Postcard Large)
// For Postcard Large Image
// Custom Validator
function IsRequirePostCardLargeImage(source, arguments)
{    

  if (document.getElementById("ctl00_ctn1_ctrlPostCard_HiddenLargeImage").value == "" && document.getElementById("ctl00_ctn1_ctrlPostCard_fuCardLarge").value =="")
  {
       arguments.IsValid = false;
        return false;
        
   }
   
  else
  { 
        arguments.IsValid = true;
       return true;
  }
}


// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Image Gallery for Thumbnail Image)
// Custom Validator
function IsRequireThumbnailImageGallery(source, arguments)
{     
      if (document.getElementById("ctl00_ctn1_hideenImageGallery").value == "" && document.getElementById("ctl00_ctn1_fuImageGallery").value =="")
      {
            arguments.IsValid = false;
            return false;
      }
      else
      {     
         if(document.getElementById("ctl00_ctn1_hideenImageGallery").value != "" && document.getElementById("ctl00_ctn1_fuImageGallery").value =="")
            {
                
                arguments.IsValid = true;
                return true;
            }
      }
}

// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Image Gallery for Large Image)
// Custom Validator
function IsRequireLargeImageGallery(source, arguments)
{     
      if (document.getElementById("ctl00_ctn1_hideenLargeImageGallery").value == "" && document.getElementById("ctl00_ctn1_fuImageGalleryLarge").value =="")
      {
            arguments.IsValid = false;
            return false;
      }
      else
      {     
         if(document.getElementById("ctl00_ctn1_hideenLargeImageGallery").value != "" && document.getElementById("ctl00_ctn1_fuImageGalleryLarge").value =="")
            {
                
                arguments.IsValid = true;
                return true;
            }
      }
}

// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Image Gallery)
// Custom Validator
function IsRequirCity(source, arguments)
{     
    var ImageGalleryforCountry=document.getElementById('ctl00_ctn1_radListImageGalleryfor_0');
    var ImageGalleryforState=document.getElementById('ctl00_ctn1_radListImageGalleryfor_1');
    var ImageGalleryforCity=document.getElementById('ctl00_ctn1_radListImageGalleryfor_2');
    var lbltxt=document.getElementById('ctl00_ctn1_lblcitychanged'); 
    var ddlCity=document.getElementById('ctl00_ctn1_ddlCity');   
   
    var Txtcity='';
    var IsTrue=false;
    var IsValid=false;
    for(i = 0; i < document.forms[0].elements.length; i++)
     {
        elm = document.forms[0].elements[i]         
        if (elm.type == 'text') 
        { 
            if(elm.name.indexOf("txtcity")>0)
            {                
                Txtcity=elm.value;                    
            }
        }
     }     
     
    if(ImageGalleryforCountry.checked==true)
    {  
        IsValid = true;
        IsTrue= true;
    }
    else if(ImageGalleryforState.checked==true)
    {  
        IsValid = true;
        IsTrue= true;
    }
    else if(ddlCity.selectedIndex >0 && ImageGalleryforCity.checked==true && lbltxt.innerHTML != 'DropDown City')
    {
        IsValid = true;
        IsTrue= true;
    }
    else
    {   
        if(lbltxt.innerHTML == 'DropDown City')
         {  
             ddlCity.selectedIndex=0;
             if(_slsTrim(Txtcity) !="" && ddlCity.selectedIndex ==0)
                {
                  IsValid =true;                            
                   IsTrue= true;    
                }
             else 
                {
                 Txtcity.value='';
                 source.errormessage="Please enter City name.";
                 IsValid = false;                                      
                 IsTrue= false;       
                } 
         }
        else
         {
            ddlCity.selectedIndex=0;
           source.errormessage="Please select City name.";
           IsValid =false;                            
           IsTrue= false;  
         }
    }
    arguments.IsValid=IsValid;
    return IsTrue;
}

// SUPER/IMAGE GALLERY ***********

// Create By : Girish Sharma
// Create Date : 22-08-2007
// Module : Settings Module(Image Gallery)
// Custom Validator
function IsRequirState(source, arguments)
{     
    var ImageGalleryforCountry=document.getElementById('ctl00_ctn1_radListImageGalleryfor_0');
    var ImageGalleryforState=document.getElementById('ctl00_ctn1_radListImageGalleryfor_1');
    var ImageGalleryforCity=document.getElementById('ctl00_ctn1_radListImageGalleryfor_2');
    var ddlState=document.getElementById('ctl00_ctn1_ddlState');   
    if(ImageGalleryforCountry.checked)
    {  
        arguments.IsValid = true;
        return true;
    }
    else if(ddlState.value >0 && ImageGalleryforState.checked==true)
    {   
        arguments.IsValid = true;
        return true;
    }
    else if(ddlState.value >0 && ImageGalleryforCity.checked==true)
    {   
        arguments.IsValid = true;
        return true;
    }
    else
    {   
        arguments.IsValid = false;
        return false;
    }
}

// Create By : Girish Sharma
// Create Date : 07-08-2007
// Function : EnableDisableControlsImageGallery()
// Module : Super/ImageGallery

function EnableDisableControlsImageGallery(ddlCountry,ddlState,ddlCity,PanelId)
{
    var ImageGalleryforCountry=document.getElementById('ctl00_ctn1_radListImageGalleryfor_0');
    var ImageGalleryforState=document.getElementById('ctl00_ctn1_radListImageGalleryfor_1');
    var ImageGalleryforCity=document.getElementById('ctl00_ctn1_radListImageGalleryfor_2');
     var PanelCit;
    if(PanelId !=null)
    {
     PanelCity=document.getElementById(PanelId);
    }
    var Country = document.getElementById(ddlCountry);
    var State = document.getElementById(ddlState);  
    var City = document.getElementById(ddlCity); 
    var count;
    if(ImageGalleryforCountry !=null && ImageGalleryforState !=null && ImageGalleryforCity !=null)
    {
            if(ImageGalleryforCountry.checked==true)
            {  
                 // Clear City From Drop Down List
                for (count = City.options.length ; count >=1 ; count--)
                {
                    City.remove(count);
                }
                City.disabled=true;
                State.disabled=true;
                State.value=0;
                City.value=0;
                PanelCity.style.display = "none"; 
            }
            else if(ImageGalleryforState.checked==true)
            {  
                Country.disabled=false;
                State.disabled=false;
                City.disabled=true;
                City.value=0;
                PanelCity.style.display = "none"; 
            }
            else if(ImageGalleryforCity.checked==true)
            {
                Country.disabled=false;
                State.disabled=false;
                City.disabled=false;
                PanelCity.style.display = "block"; 
            }
          }  
}
//END : EnableDisableControlsImageGallery()


//END:  SUPER/IMAGE GALLERY **********



//Create By : Devraj Chauhan
//Create Date : 22-08-2007
//Module : Settings Module(GroupBookingSettings)

function ShowHideRestrictionPanel(pnlRoomRestriction,rbRoomType)
{
    var rbRoomType1= document.getElementById(rbRoomType+'_0');   
    var pnlRoomRestriction1= document.getElementById(pnlRoomRestriction);   
     if(rbRoomType1 !=null && pnlRoomRestriction1 !=null)
     {
        if(rbRoomType1.checked)
         {       
            pnlRoomRestriction1.style.display = "";       
         }
        else
        {  
           pnlRoomRestriction1.style.display = "none"; 
        }        
    }
}

//  Create By : Girish Sharma
//  Create Date : 26-09-2007
//  Module : Group/RoomList
//  Purpose : to Bind RoomName in Textbox without postback from room type dropdown

function RoomList_RoomType(ddlRoomType,TxtRoomName)
{
    var RoomType= document.getElementById(ddlRoomType);   
    var RoomName= document.getElementById(TxtRoomName);   
    
    RoomName.value= RoomType.options[RoomType.selectedIndex].innerHTML;
    
}



//Create By : Devraj Chauhan
// Create Date : 21-08-2007
// Module : Event Module(EventManagement)
function DateCompareEvent(source, arguments)
{      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("ctrlTxtDisplayDate")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("ctrlTxtEventDate")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
	//var strDateFrom;
	//strDateFrom = document.getElementById(txtDateFrom).value;
	var FromDate = strDateFrom.split('/');
	fromYear 	 = FromDate[2];
	fromMonth	 = FromDate[1];
	fromDate	 = FromDate[0];

	//var strDateTo;
	//strDateTo = document.getElementById(txtDateTo).value;
	var ToDate = strDateTo.split('/');
	toYear 	 = ToDate[2];
	toMonth	 = ToDate[1];
	toDate	 = ToDate[0];

    if(toYear > fromYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(toYear < fromYear)
    {
        //alert('From Date must be greater than or equal to To Date');
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(toMonth > fromMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }	

	    else if(toMonth < fromMonth)
	    {
		    //alert('From Date must be greater than or equal to To Date');
		    arguments.IsValid = false;
            return false;
	    }	
	    else
	    {
		    if(toDate >= fromDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else		    
		    {   //alert('From Date must be greater than or equal to To Date');
		       arguments.IsValid = false;
                return false;
		    }
    		
	    }
    }
}


function ChangeCheckBoxState(id, checkState)
   {
      var cb = document.getElementById(id);
      if (cb != null)
         cb.checked = checkState;
   }

   function ChangeAllCheckBoxStates(chkid,datagridid)
   { 
      var checkboxid = document.getElementById(chkid); 
      var dgid = document.getElementById(datagridid); 
                     
      if (dgid != null)
      {
           
          for (var i = 0; i < dgid.rows.length; i++)                   
            {      
                var chkBoxes  =  dgid.getElementsByTagName("input");
      
                if(chkBoxes[i].type == "checkbox" || chkBoxes[i].type == "CHECKBOX")
                   if(checkboxid.checked)
                         {
                             chkBoxes[i].checked = true;               
		                 }  
		           else
                         {
                            chkBoxes[i].checked = false; 
                         }                                            
            }            
      }
   }
   
   
   
   
  function UncheckID(chkid,hfid,chksendtoall,lblid)
  {         
       var gccheckboxid =   document.getElementById(chkid);   
       var hiddenfieldid =  document.getElementById(hfid);
       var chksend =   document.getElementById(chksendtoall);
       var memberid=   document.getElementById(lblid);
       
       if(chksend.checked == true || gccheckboxid.checked == false)
           {
               if(gccheckboxid.checked = false)
                  {
                     hiddenfieldid.value = hiddenfieldid.value + memberid +',';
                  }
               else
                 {                         
                      //hiddenfieldid.value = hiddenfieldid.value + replace(memberid+',','');
                 }  
           }       
   }
           
           //Create By : Devraj Chauhan
// Create Date : 23-08-2007
// Module : Settings Module(NormalBookingSettings)

function ShowHideCreditCardPanel(pnlCards,rblCreditcards)
{
    var rblCreditcards1= document.getElementById(rblCreditcards+'_0');   
    var pnlCards1= document.getElementById(pnlCards);   
     
     if(rblCreditcards1.checked)
         {          
                 
         pnlCards1.style.display = "";       
         }
        else
        {     
          
           pnlCards1.style.display = "none"; 
         }        

}



function DateCompareAddeditPollSearch(source, arguments)
    {      

        var strDateFrom='';
        var strDateTo='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtstartdatesearch")>0)
                { 
                    strDateFrom=elm.value;
                }
                
                 if(elm.name.indexOf("txtenddatesearch")>0)
                {  
                    strDateTo=elm.value;
                }
            }
         }
	//var strDateFrom;
	//strDateFrom = document.getElementById(txtDateFrom).value;
	var FromDate = strDateFrom.split('/');
	fromYear 	 = FromDate[2];
	fromMonth	 = FromDate[1];
	fromDate	 = FromDate[0];

	//var strDateTo;
	//strDateTo = document.getElementById(txtDateTo).value;
	var ToDate = strDateTo.split('/');
	toYear 	 = ToDate[2];
	toMonth	 = ToDate[1];
	toDate	 = ToDate[0];

    if(toYear > fromYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(toYear < fromYear)
    {
        //alert('From Date must be greater than or equal to To Date');
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(toMonth > fromMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }	

	    else if(toMonth < fromMonth)
	    {
		    //alert('From Date must be greater than or equal to To Date');
		    arguments.IsValid = false;
            return false;
	    }	
	    else
	    {
		    if(toDate >= fromDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else		    
		    {   //alert('From Date must be greater than or equal to To Date');
		       arguments.IsValid = false;
                return false;
		    }
    		
	    }
    }
}

// Create By : Ashish Kumar Srivastava
// Create Date : 23-08-2007
// Function : ShowHideSeperateEmail()

function ShowHideSeperateEmail(chkSeperateEmailId,divSeperateEmailId)
{

      var varchkSeperateEmailId = document.getElementById(chkSeperateEmailId); 
      var vardivSeperateEmailId = document.getElementById(divSeperateEmailId); 
      
      if(varchkSeperateEmailId.checked==true) 
      {          
         vardivSeperateEmailId.disabled = false;     
      }
      else
      {   
         vardivSeperateEmailId.disabled = true;
      }       

}

function IsRequireCityForJob(source, arguments)
{
    var ListBox= arguments.Value;
    
   var LstSelectedCity =document.getElementById(ListBox);
   if(LstSelectedCity.options.length==0)
   {
        arguments.IsValid = false;
       return false;
   }
   else
   {
       arguments.IsValid = true;
       return true;
   }
}

// Create By : Ashish Kumar Srivastava
// Create Date : 23-08-2007
// Function : IsRequirddlSeperateEmail()
// Custom Validator
function IsRequirddlSeperateEmail(source, arguments)
{ 
     var varchkSeperateEmailId = document.getElementById('ctl00_ctn1_chkSeperateEmailId'); 
     var vartxtSeperateEmailId = document.getElementById('ctl00_ctn1_txtEmail'); 
  
      if(varchkSeperateEmailId.checked==true) 
      { 
        if(vartxtSeperateEmailId.value!='')
        {
            arguments.IsValid = true;
            return true;
        }
        else
        {
        arguments.IsValid = false;
        return false;
        }
      }
      else
      {
        arguments.IsValid = true;
        return true;
      }
}

// Create By : Devraj Chauhan
// Create Date : 24-08-2007
// Function : ViewPopupForEventImage()

function ViewPopupForEventImage(url)
{

    var newwindow; 
    newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=no,height=200,width=200');
    if (window.focus) {newwindow.focus();}
   return false;
} 

function ShowHideMultiLevelPrice(chk,divId)
{
      var varchk = document.getElementById(chk); 
      var vardivId = document.getElementById(divId); 
      
      if(varchk.checked==true) 
      {  
       vardivId.style.display = "";       
      }
      else
      {     
          vardivId.style.display = "none"; 
      }               

}

function AddPriceOnBooking(chechbox)
{
    
    var vardivTotal=document.getElementById("divToatal");
     var Total=parseFloat(vardivTotal.innerText)+parseFloat(chechbox.value);
     vardivTotal.innerText=Total;
    
}


// Create By : Girish Sharma
// Create Date : 6-08-2007
// Function : EnableDisableControls()
// Module : Memper Home Hostel Search
function EnableDisableControls(rbFindCity,ddlCountry,ddlCity,TxtSpecificHostel)
{
    var FindCity = document.getElementById(rbFindCity); 
    var Country = document.getElementById(ddlCountry); 
    var City = document.getElementById(ddlCity); 
    var SpecificHostel= document.getElementById('ctl00_ucSearch_txtSpecificHostel'); 
    var rbCountry= document.getElementById('ctl00_ucSearch_rbCountry');
    if(FindCity.checked)
    {
        Country.disabled=true;
        
        // Clear City Drop Down List
        var count;
        for (count = City.options.length ; count >=1 ; count--)
        {
            City.remove(count);
        }
        City.disabled=true;
        Country.value=-1;
        City.value=-1;
        SpecificHostel.disabled=false;
        SpecificHostel.style.background="#ffffff";
    }
   if(rbCountry.checked)
    {
        Country.disabled=false;
        City.disabled=false;
        SpecificHostel.disabled=true;
        SpecificHostel.value='';
        SpecificHostel.style.background="#cccccc";
    }
}
//END : EnableDisableControls()

// Create By : Girish Sharma
// Create Date : 6-08-2007
// Function : PopupPickerFindHostel()
// Module : Date Selection Method

function PopupPickerFindHostel(ctl,ctl2,ctl3, CalPagePath)
{   
    var varSeletedDate = document.getElementById(ctl2).value + "/" + document.getElementById(ctl).value + "/" + document.getElementById(ctl3).value;
    var w = 220;
    var h = 225;
    var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
    var PopupWindow=null;
    settings='width='+ w + ',height='+ h + ',top='+wint+',left='+winl+ ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
    PopupWindow = window.open(CalPagePath + '?Ctl=' + ctl +'|'+ ctl2 +'|' + ctl3 + '&selDate=' + varSeletedDate, 'DatePicker',settings);    
    if (parseInt(navigator.appVersion) >= 4) { PopupWindow.window.focus(); }
}
//END : PopupPickerFindHostel()

function viewpopupforBookingDetails(url)
{
 
    var newwindow; 
    newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=no,height=250,width=300,left=280,top=100');
    if (window.focus) {newwindow.focus();}
   return false;
} 


function viewpopupforNewsLettersetting(url)
{
  
    var newwindow; 
    newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=500,width=600,left=280,top=100');
    if (window.focus) {newwindow.focus();}
   return false;
} 


function ViewPopupTermsAndCondition(url,TermsNumber)
{
  
    var newwindow; 
    newwindow=window.open(url + '?Terms=' +TermsNumber,'TermsAndConditions','toolbar=no,location=0,menubar=no,scrollbars=yes,height=500,width=600,left=280,top=100');
    if (window.focus) {newwindow.focus();}
   return false;
} 


function viewpopuppolicy(url,PolicyID,PRPMID)
{
    
    var newwindow; 
    newwindow=window.open('http://www.smartbackpackers.com/Popup/privacypolicy.aspx' + '?PolicyID=' + PolicyID + '&PRPMID=' +PRPMID,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=500,width=600,left=300,top=100');
    if (window.focus) {newwindow.focus();}
   return false;
} 


function viewpopupForgetPassword(url)
{
    var newwindow; 
    newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=no,height=500,width=600,left=300,top=100');
    if (window.focus) {newwindow.focus();}
   return false;
} 

function ViewPopupRoomFacility(url,PropertyId,RoomId)
{   
    
    var newwindow; 
    newwindow=window.open(url + '?PropertyId=' + PropertyId + '&RoomID=' +RoomId,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=250,width=360,left=300,top=100');
    if (window.focus) {newwindow.focus();}
   return false;
} 

// function FillValuesBillingToShipping()
// purpose to fill value billing to shipping
// created by Ashish
// Created Date 12 Sep 2007
function FillValuesBillingToShipping()
{
 
    if(document.getElementById("ctl00_ctn1_chkShipping").checked)
    {
      
        var CustFName = document.getElementById("ctl00_ctn1_txtCustFName").value;
	    document.getElementById("ctl00_ctn1_txtShipCustFName").value = CustFName;

        var CustLName = document.getElementById("ctl00_ctn1_txtCustLName").value;
	    document.getElementById("ctl00_ctn1_txtShipCustLName").value = CustLName;
	    
        var CustAddress = document.getElementById("ctl00_ctn1_txtCustAddress").value;
	    document.getElementById("ctl00_ctn1_txtShipCustAddress").value = CustAddress;
	    
	    var CustTelephone = document.getElementById("ctl00_ctn1_txtCustTelephone").value;
	    document.getElementById("ctl00_ctn1_txtShipCustTelephone").value = CustTelephone;
	    
	    var CustPostCode = document.getElementById("ctl00_ctn1_txtCustPostCode").value;
	    document.getElementById("ctl00_ctn1_txtShipCustPostCode").value = CustPostCode;
	    
	    var CustFax = document.getElementById("ctl00_ctn1_txtCustFax").value;
	    document.getElementById("ctl00_ctn1_txtShipCustFax").value = CustFax;
	    
	    var CustEmail = document.getElementById("ctl00_ctn1_txtCustEmail").value;
	    document.getElementById("ctl00_ctn1_txtShipCustEmail").value = CustEmail;
	    
        document.getElementById("ctl00_ctn1_ddlShipCountry").value = document.getElementById("ctl00_ctn1_ddlCustCountry").value;
        
        // ddlState
        
        // Fill the shipping state combo at this stage at client side by billing state combo     
        
        
        // ddl City
        if(document.getElementById("ctl00_ctn1_ddlShipCity").disabled == true)
        {
           document.getElementById("ctl00_ctn1_ddlShipCity").disabled = true;
        }
        else
        {
            document.getElementById("ctl00_ctn1_ddlShipCity").disabled = false;
        }
      
        // Fill the shipping city combo at this stage at client side by billing city combo
        var CtCount = document.getElementById("ctl00_ctn1_ddlCustCity").length;
        for (var i = CtCount - 1; i >= 0; i--)
	    {
	        var txt = document.getElementById("ctl00_ctn1_ddlCustCity").options[i].text;
	        var val = document.getElementById("ctl00_ctn1_ddlCustCity").options[i].value;
	        document.getElementById("ctl00_ctn1_ddlShipCity").options[i] = new Option(txt, val);	
	        
	        if(document.getElementById("ctl00_ctn1_ddlCustCity").options[i].selected)
	        {
	         document.getElementById("ctl00_ctn1_ddlShipCity").options[i].selected=true;
	        }
	        	
	    }
	    
        document.getElementById("ctl00_ctn1_ddlShipCity").value = document.getElementById("ctl00_ctn1_ddlCustCity").value;
        
        

        // txtState
        
        //document.getElementById("ctl00_ctn1_txtShipState").value = document.getElementById("ctl00_ctn1_txtCustState").value;
        
        // txtCity
        if(document.getElementById("ctl00_ctn1_txtCustCity").disabled == true)
        {
           document.getElementById("ctl00_ctn1_txtShipCity").disabled = true;
        }
        else
        {
            document.getElementById("ctl00_ctn1_txtShipCity").disabled = false;
        }
        document.getElementById("ctl00_ctn1_txtShipCity").value = document.getElementById("ctl00_ctn1_txtCustCity").value;
        
        if(document.getElementById("ctl00_ctn1_ddlCustCity").value == 'Others')
        {
           document.getElementById("ctl00_ctn1_txtShipCity").value = document.getElementById("ctl00_ctn1_txtCustCity").value;
        }
        else
        {
            document.getElementById("ctl00_ctn1_txtShipCity").disable = true;
        }
        //document.getElementById("ctl00_ctn1_txtShipCity").value = document.getElementById("ctl00_ctn1_txtCustCity").value;
        
    }
    else
    {
        document.getElementById("ctl00_ctn1_txtShipCustFName").value = "";
        document.getElementById("ctl00_ctn1_txtShipCustLName").value = "";
        
        document.getElementById("ctl00_ctn1_txtShipCustAddress").value = "";
	    document.getElementById("ctl00_ctn1_txtShipCustTelephone").value = "";
	    document.getElementById("ctl00_ctn1_txtShipCustPostCode").value = "";
	    document.getElementById("ctl00_ctn1_txtShipCustFax").value = "";
	    document.getElementById("ctl00_ctn1_txtShipCustEmail").value = "";
        
        
        document.getElementById("ctl00_ctn1_txtShipCity").value = "";
        
        
        document.getElementById("ctl00_ctn1_ddlShipCity").disabled = true;
        
        document.getElementById("ctl00_ctn1_txtShipCity").disabled = true;
        
        document.getElementById("ctl00_ctn1_ddlShipCountry").selectedIndex = 0;
        
        document.getElementById("ctl00_ctn1_ddlShipCity").selectedIndex = 0;
    }
}

// Callback for UserSearch in Member Section
// Created By   :   Girish Sharma
// Created Date :   13/09/2007  
var UserSearch_oGlobalCityId;

function DisableCity()
{
    var oCity = document.getElementById(UserSearch_oGlobalCityId);
    oCity.disabled = true;
}

function UserSearch_CallServer(oCountryId,oCityId)
{       
    UserSearch_oGlobalCityId = oCityId;
    var oCountryValue,oCountry;
    oCountry = document.getElementById(oCountryId);
    oCountryValue = oCountry.options[oCountry.selectedIndex].value;
    ExecuteCallback(oCountryValue,"");
}
function UserSearch_GetData(rValue)
{   
    var oCountry = document.getElementById(UserSearch_oGlobalCityId);
    var oData = rValue.split("!");
    var oCount;
    var oIndex=0;
    for(oCount=0; oCount< (oData.length-1); ++oCount)
        {
            var oOptionData = oData[oCount].split("~");
            //oCountry.options[++oIndex]= new Option(oOptionData[1],oOptionData[0]);
            
             var option = document.createElement("OPTION");
            option.value = oOptionData[1];
            option.innerHTML = oOptionData[0]; 
            
            oCountry.options[++oIndex]= new Option(option.value,option.innerHTML);
            //oCountry.appendChild(option);
            //alert(option);
        }
        
    oIndex+=1;
    
    if(oCountry !=null)
    {
        for(;oIndex < (oCountry.options.length);)
            {
              oCountry.remove(oIndex);
            }
        oCountry.disabled = false;
    }
}

function CallbackError()
{
        alert("Error in callback");
}  

    
// End Callback

// function is used to print conents of required div in member section
// Created By   :  Devraj Chauhan
// Created Date :  19/09/2007  

    function printCMS()
    {       
      
      var content_value = document.getElementById("divContent").innerHTML;  
      var docprint=window.open('','name','width=750,height=600,menubar=no,toolbar=no,scrollbars=Yes,resizable=no,dependent=no'); 
       docprint.document.open(); 
       docprint.document.write('<html><head><title>Property CMS Contents</title>');
       docprint.document.write(' <link href="../App_Themes/Default/Default.css" type="text/css" rel="stylesheet" media="print" />'); 
       docprint.document.write('</head ><body bgcolor="#ffffff">');  
       docprint.document.write('<div class="clear"></div><div class="heading"></div><div class="clear"></div><BR /><BR />');          
       docprint.document.write(content_value); 
       docprint.document.write('<div class="clear"></div><BR /><div id="DivButtos" style = "width:450px;padding-left:250px;float:left;text-align:center;vertical-align:middle"><a href="#" onclick="javascript:window.close();">[Close Window]</a>&nbsp;&nbsp; | &nbsp;&nbsp;<a href="#" onclick="javascript:print();window.close();">[Print]</a><div class="clear"></div></div>');        
       docprint.document.write('</body></html>'); 
       docprint.document.close(); 
       docprint.focus(); 
       return false;
    }
    
    
     function printbookingSummary(url)
	 {
	    
	    var newwindow; 
        newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=700,width=800,left=200,top=100');
      
        if (window.focus) {newwindow.focus();} 
         alert(newwindow.document);
        var content_value = document.getElementById("divContent").innerHTML; 
        var content =    newwindow.document.getElementById("content");        
        content.innerHTML= content_value;
        return false; 
      }
    

// On/Off MenuBar  in Member/DestinationGuide Section
// Created By   :   Ambuj Shukla
// Created Date :   14/09/2007  

function DestinationGuide_MenuControl(Menuid)
{   
    var MenuName = document.getElementById(Menuid);
    if(MenuName.style.display == 'none')
     {
        MenuName.style.display = 'block';
     }
     else
     {
     MenuName.style.display = 'none';
     }

}

function ViewTextPopup(url)
{   

    var newwindow; 
    newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=no,height=400,width=400,resizable=yes');
    if (window.focus) {newwindow.focus();}    
   return false;
   
} 
function ViewTextPopupforhostelrating(url)
{   

    var newwindow; 
    newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,resizable=yes,width=700');
    if (window.focus) {newwindow.focus();}    
   return false;
   
} 

function ViewTextPopupForoffertemplate(url)
{   
    var newwindow; 
    newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=500,width=600,left=300,top=100,resizable=no');
    if (window.focus) {newwindow.focus();}    
   return false;
   
} 


function ViewMoreAvailability(url,PropertyId,ArrivalDate,NumberOfNight,NumberOfPerson)
{   
    var newwindow; 
   // newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,resizable=yes,width=500');
   NewWindow=window.open(url + '?PropertyId=' + PropertyId + '&ArrivalDate=' + ArrivalDate + '&NumberOfNight=' + NumberOfNight+ '&NumberOfPerson=' + NumberOfPerson,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=220,width=260,left=350,top=100');
  
    if (window.focus) {NewWindow.focus();}    
   return false;
   
} 

function EnableDisablechainname(radbtnname,panelname)
{

    var radbenidyes= document.getElementById("ctl00_ctn1_rbpartofchain_0");
    var radbenidNo= document.getElementById("ctl00_ctn1_rbpartofchain_1");
    
    var panelid = document.getElementById(panelname);    
     
    if (radbenidyes.checked)
      { 
     
            panelid.style.display = 'block';
       }
      else
      {
            panelid.style.display = 'none';
           
      }
      
}

function OnLoadpropertypage(panelname)
{
  var panelid = document.getElementById(panelname);

  panelid.style.display = 'none';
}


function IsRequiredchainname(source, arguments)
{         
        var radbenidyes= document.getElementById("ctl00_ctn1_rbpartofchain_0");     
        var txtchainname = document.getElementById('ctl00$ctn1$txtchainname');         
        var Txtchainname='';
       
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtchainname")>0)
                {                 
                    Txtchainname=elm.value;                    
                }
            }
         }       
         if(radbenidyes.checked)
         {    
             if(Txtchainname.length >0)
                 {             
                        arguments.IsValid =true;                            
                        return true;                 
                 }
            else 
                    {           
                         arguments.IsValid = false;                                      
                         return false;                    
                    }   
         }
         else
            {  
               arguments.IsValid = true;            
               return true;                    
            }  
}


function IsRequiredunits(source, arguments)
{         
        var radbenidyes= document.getElementById("ctl00_ctn1_rbpartofchain_0");     
        var txtunits = document.getElementById('ctl00$ctn1$txtunits');         
        var Txtnoofunits='';
       
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtunits")>0)
                {   
                                 
                    Txtnoofunits=elm.value;                    
                }
            }
         }       
         if(radbenidyes.checked)
         {    
             if(Txtnoofunits.length >0)
                 {             
                          
                        arguments.IsValid =true;                            
                        return true;  
                                     
                 }
            else 
                    {           
                          
                        arguments.IsValid = false;                                      
                         return false;                       
                    }   
         }
         else
            {  
                   
               arguments.IsValid = true;            
               return true;                    
            }  
}




// Create By : Girish Sharma
// Create Date : 24-09-2007
// Function : IsRequireUserSearchCountry
// Module : Member Section/User Search/Home Page
// Custom Validator
function IsRequireUserSearchCountry(source, arguments)
{ 
     var rbCountry = document.getElementById('ctl00_ucSearch_rbCountry'); 
     var ddlcountry = document.getElementById('ctl00_ucSearch_ddlCountry'); 
      
     var rbFinCity = document.getElementById('ctl00_ucSearch_rbFindCity'); 
     var TxtUserSearchCity = document.getElementById('ctl00_ucSearch_txtSpecificHostel'); 
//alert(ddlcountry.value + " , "+ ddlCity.value);
      if(rbCountry.checked) 
      { 
        if(ddlcountry.value >0)
        {
            arguments.IsValid = true;
            return true;
        }
        else
        {
            arguments.IsValid = false;
            return false;
        }
      }
      
      if(rbFinCity.checked) 
      {
           arguments.IsValid = true;
           return true;
      }
}

// Create By : Girish Sharma
// Create Date : 24-09-2007
// Function : IsRequireUserSearchCountry
// Module : Member Section/User Search/Home Page
// Custom Validator
function IsRequireUserSearchCity(source, arguments)
{ 
     var rbCountry = document.getElementById('ctl00_ucSearch_rbCountry'); 
     var ddlCity = document.getElementById('ctl00_ucSearch_ddlCity'); 
     
     var rbFinCity = document.getElementById('ctl00_ucSearch_rbFindCity'); 
    
      if(rbCountry.checked) 
      { 
        if(ddlCity.value >0)
        {
            arguments.IsValid = true;
            return true;
        }
        else
        {
            arguments.IsValid = false;
            return false;
        }
      }
      
      if(rbFinCity.checked) 
      {
           arguments.IsValid = true;
           return true;
      }
}





// Create By : Girish Sharma
// Create Date : 24-09-2007
// Function : IsRequireUserSearchCityName
// Module : Member Section/User Search/Home Page
// Custom Validator
function IsRequireUserSearchCityName(source, arguments)
{ 
     var rbCountry = document.getElementById('ctl00_ucSearch_rbCountry'); 
     var rbFinCity = document.getElementById('ctl00_ucSearch_rbFindCity'); 
     var TxtUserSearchCity = document.getElementById('ctl00_ucSearch_txtSpecificHostel'); 
    
      if(rbFinCity.checked) 
      {
        
        if(_slsTrim(TxtUserSearchCity.value) != "")
        {  
            arguments.IsValid = true;
            return true;
        }
        else
        {  
            TxtUserSearchCity.value='';
            arguments.IsValid = false;
            return false;
        }
      
      }
      if(rbCountry.checked) 
      {     
           arguments.IsValid = true;
           return true;
      }
}


// Create By : Girish Sharma
// Create Date : 24-08-2007
// Function : DisableEnablePropertyCheckBox()
// Module : Super/ManageAnnouncement

function DisableEnablePropertyCheckBox()
{
    var radOptionFor0=document.getElementById('ctl00_ctn1_radOptionFor_0');
    var radOptionFor1=document.getElementById('ctl00_ctn1_radOptionFor_1');
    var radOptionFor2=document.getElementById('ctl00_ctn1_radOptionFor_2');
     var pnlPropertyCheckBoxList=document.getElementById('ctl00_ctn1_pnlPropertyCheckBoxList');
  if(radOptionFor0 !=null && radOptionFor1 !=null && radOptionFor2 !=null)
  {
        if(radOptionFor0.checked==true)
        {  
            pnlPropertyCheckBoxList.style.display = 'none';
        }
        else if(radOptionFor1.checked==true)
        {  
            pnlPropertyCheckBoxList.style.display = 'block';
        }
        else if(radOptionFor2.checked==true)
        {
             pnlPropertyCheckBoxList.style.display = 'block';
        }
   }
}

// Create By : Girish Sharma
// Create Date : 24-09-2007
// Function : IsRequireSearchCountry
// Module : Member Section/Search/BookingSearch Page
// Custom Validator
function IsRequireSearchCountry(source, arguments)
{ 
     var ddlcountry = document.getElementById('ctl00_ctn1_LeftControl1_cntSearch_ddlCountry'); 
   
       if(ddlcountry !=null)
       {
            if(ddlcountry.value >0)
            {
                arguments.IsValid = true;
                return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
        }
         else
            {
                arguments.IsValid = false;
                return false;
            }
}

// Create By : Girish Sharma
// Create Date : 24-09-2007
// Function : IsRequireSearchCity
// Module : Member Section/Search/BookingSearch Page
// Custom Validator
function IsRequireSearchCity(source, arguments)
{ 
     var ddlcity = document.getElementById('ctl00_ctn1_LeftControl1_cntSearch_ddlCity'); 
     if(ddlcity !=null)
     {
        if(ddlcity.value >0)
        {
            arguments.IsValid = true;
            return true;
        }
        else
        {
            arguments.IsValid = false;
            return false;
        }
     }
      else
        {
            arguments.IsValid = false;
            return false;
        }
}



// Create By : Ambuj Shukla
// Create Date : 15-09-2007
// Function : DisableEnablePropertyCheckBox()
// Module : Member/MemberRegistration
 function citychanged(linbuttonid,paneldropdowncity,panelcitytxt)
{ 
    
    var linkbtnid= document.getElementById(linbuttonid);
    
    var paneldropdowncityname = document.getElementById(paneldropdowncity);
    var panelcitytxtname = document.getElementById(panelcitytxt);  
    var lbltext = linkbtnid.firstChild.data;      
      if(linkbtnid.firstChild.data == 'City Not Listed?') 
        {            
            linkbtnid.firstChild.data = 'DropDown City';             
            paneldropdowncityname.style.display = 'none';                        
            panelcitytxtname.style.display = 'block';
            document.getElementById('ctl00_ctn1_ddlCity').selectedIndex = 0;
            document.getElementById('ctl00_ctn1_txtcity').value = '';
        }
      if(lbltext == 'DropDown City')
       {    
            linkbtnid.firstChild.data = 'City Not Listed?';
            paneldropdowncityname.style.display = 'block';
            panelcitytxtname.style.display = 'none';
            
       }
}





function Controlcitychanged(linbuttonid,paneldropdowncity,panelcitytxt,ddlCity,txtcity)
{ 
    
    var linkbtnid= document.getElementById(linbuttonid);
    var paneldropdowncityname = document.getElementById(paneldropdowncity);
    var panelcitytxtname = document.getElementById(panelcitytxt);  
    var lbltext = linkbtnid.firstChild.data;      
      if(linkbtnid.firstChild.data == 'City Not Listed?') 
        {            
            linkbtnid.firstChild.data = 'DropDown City';             
            paneldropdowncityname.style.display = 'none';                        
            panelcitytxtname.style.display = 'block';
            //document.getElementById('ctl00_ctn1_ctrlcity_ddlCity').selectedIndex = 0;
            //document.getElementById('ctl00_ctn1_ctrlcity_txtcity').value = '';
            document.getElementById(ddlCity).selectedIndex = 0;
            document.getElementById(txtcity).value = '';
            
        }
      if(lbltext == 'DropDown City')
       {    
            linkbtnid.firstChild.data = 'City Not Listed?';
            paneldropdowncityname.style.display = 'block';
            panelcitytxtname.style.display = 'none';
           
       }
}

function CityDropDownDefault(paneldropdowncity,panelcitytxt,lblcitychanged)
{
   var PanelCity=document.getElementById(paneldropdowncity);
   var PanelCityText=document.getElementById(panelcitytxt);
   var lblCity=document.getElementById(lblcitychanged);
   if(PanelCity !=null)
   {
    PanelCity.style.display = 'inline';
   }
   if(PanelCityText !=null)
   {
    PanelCityText.style.display = 'none';
   }
   if(lblCity !=null)
   {
    var i =document.createTextNode('City Not Listed?');
    lblCity.appendChild(i);
   }
}
function CityTextChanged(linbuttonid,paneldropdowncity,panelcitytxt,CityClientID,TxtCityClientId)
{  
    if(paneldropdowncity !=null && linbuttonid !=null && panelcitytxt !=null)
    {
         var linkbtnid= document.getElementById(linbuttonid);
         var paneldropdowncityname = document.getElementById(paneldropdowncity);
         var panelcitytxtname = document.getElementById(panelcitytxt);  
         var lbltext = linkbtnid.firstChild.data;      
          if(linkbtnid.firstChild.data == 'City Not Listed?') 
            {            
                linkbtnid.firstChild.data = 'DropDown City';             
                paneldropdowncityname.style.display = 'none';                        
                panelcitytxtname.style.display = 'block';
                document.getElementById(CityClientID).value = 0;
                document.getElementById(TxtCityClientId).value = '';
            }
          if(lbltext == 'DropDown City')
           {    
                linkbtnid.firstChild.data = 'City Not Listed?';
                paneldropdowncityname.style.display = 'block';
                panelcitytxtname.style.display = 'none';
               
           }
    }
}

function qusenable(ddlname,panelname)
{
 var ddlid= document.getElementById(ddlname);
 var panelid = document.getElementById(panelname);
 var txtqus = document.getElementById('ctl00_ctn1_txtqusans');
 
          if(ddlid.value == 4)       
            {
            
                    panelid.style.display = 'inline'; 
                     
                       
            } 
           else
            {
                
                panelid.style.display = 'none';             
            }
}
function IsRequireShopCityDropdown(source, arguments)
{     
         var ddlcity=document.getElementById('ctl00_ctn1_ddlCity');
         var lbltxt=document.getElementById('ctl00_ctn1_lblcitychanged');
        
            
         if(lbltxt.innerText == 'City Not Listed?')
        {
           
            if(ddlcity.value == 0)       
            {     
              
                     arguments.IsValid = false;
                    return false;   
                   
            }
            else
                { 
                 arguments.IsValid = true;
                    return true; 
                      
                }
        }
        else
        {
                        arguments.IsValid =true;                            
                        return true;  
        
        }
}
function IsControlRequircitydropdown(source, arguments)
{  
     var IsValid=true;
     var ddlCityIds = arguments.Value.split('#') ;
     var ddlcity;
     
     //var lblEntryText= document.getElementById(ddlCityIds[1]).innerHTML;
     ddlcity=document.getElementById(ddlCityIds[0]);

     var lblEntryText=jQuery('#DivCountryStateCity').find("a[id$='lblcitychanged']").html();
     //var txtCity=jQuery('#DivCountryStateCity').find("input[id$='txtcity']").val();
     

       if(lblEntryText == 'City Not Listed?')
        {
           if(ddlcity.value == -1 || ddlcity.value==0)       
            {
              IsValid=false;   
            }
            else
            {  
                IsValid= true; 
            }
        }
        else
        {
           IsValid= true;  
        }
        
        if(IsValid)
        {
           arguments.IsValid =true;                            
           return true;  
        }
        else
        {
            arguments.IsValid = false;
            return false;  
        }
}

function IsControlRequircitytxt(source, arguments)
{   
     var IsValid=true;
     var CityIds = arguments.Value.split('#') ;
     var CityTextBox;
     //var lblText= document.getElementById(CityIds[1]).innerHTML;
     CityTextBox=document.getElementById(CityIds[0]).value;
     var CityName=CityTextBox;
        
     var lblText=jQuery('#DivCountryStateCity').find("a[id$='lblcitychanged']").html();
     var txtCity=jQuery('#DivCountryStateCity').find("input[id$='txtcity']").val();
     
     if(lblText == 'DropDown City')
         { 
             if(_slsTrim(txtCity) != "")
                 {             
                   IsValid =true;                            
                 }
            else 
                {           
                 IsValid= false;                                      
                }   
         }
        else
         {
            IsValid =true;                             
         }
         
        if(IsValid)
        {
            arguments.IsValid =true;                            
            return true;  
        }
        else
        {
              arguments.IsValid = false;
               return false;  
        }
         
}


function IsControlRequirCityTxt_2(source, arguments)
{   
     var IsValid=true;
     var CityIds = arguments.Value.split('#') ;
     var CityTextBox;
     //var lblText= document.getElementById(CityIds[1]).innerHTML;
     CityTextBox=document.getElementById(CityIds[0]).value;
     var CityName=CityTextBox;
        
     var lblText=jQuery('#DivCountryState').find("a[id$='lblcitychanged']").html();
     var txtCity=jQuery('#DivCountryState').find("input[id$='txtcity']").val();
     
    
     if(lblText == 'DropDown City')
         {  
           
             if(_slsTrim(txtCity) != "")
                 {             
                   IsValid =true;                            
                 }
            else 
                {           
                 IsValid= false;                                      
                }   
         }
        else
         {
            IsValid =true;                             
         }
         
        if(IsValid)
        {
            arguments.IsValid =true;                            
            return true;  
        }
        else
        {
              arguments.IsValid = false;
               return false;  
        }
         
}


function IsRequircitydropdown(source, arguments)
{     
         var ddlcity=document.getElementById('ctl00_ctn1_ddlCity');
         
         var lbltxt=jQuery('#DivCountryStateCity').find("a[id$='lblcitychanged']").html();
         
         //var lbltxt=document.getElementById('ctl00_ctn1_lblcitychanged');
        
         //alert(lbltxt);
         
         if(lbltxt == 'City Not Listed?')
        {
           
            if(ddlcity.value == -1)       
            {     
                 arguments.IsValid = false;
                return false;   
            }
            else
            { 
                arguments.IsValid = true;
                return true; 
                  
            }
        }
        else
        {
        arguments.IsValid =true;                            
        return true;  

        }
}


function IsRequireShopCityTxt(source, arguments)
{     
        
         var txtcity=document.getElementById('ctl00_ctn1_txtDeliveryCityName');
         var lbltxt=document.getElementById('ctl00_ctn1_lblcitychanged');
        
      var Txtcity='';
       
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtDeliveryCityName")>0)
                {   
                                 
                    Txtcity=elm.value;                    
                }
            }
         }       
         if(lbltxt.innerText == 'DropDown City')
         {  
             if(Txtcity.length >0)
                 {             
                          arguments.IsValid =true;                            
                        return true;    
                        
                 }
            else 
                    {           
                         arguments.IsValid = false;                                      
                         return false;  
                                       
                       
                                         
                    }   
                
         }
        else
         {
         arguments.IsValid =true;                            
                        return true;  
               
           
         }
}

function IsRequircitytxt(source, arguments)
{     
        
        var txtcity=document.getElementById('ctl00_ctn1_txtcity');
         var lbltxt=document.getElementById('ctl00_ctn1_lblcitychanged');
        
      var Txtcity='';
       
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtcity")>0)
                {   
                                 
                    Txtcity=elm.value;                    
                }
            }
         }       
         if(lbltxt.innerText == 'DropDown City')
         {  
             if(Txtcity.length >0)
                 {             
                          arguments.IsValid =true;                            
                        return true;    
                        
                 }
            else 
                    {           
                         arguments.IsValid = false;                                      
                         return false;  
                                       
                       
                                         
                    }   
                
         }
        else
         {
         arguments.IsValid =true;                            
                        return true;  
               
           
         }
}




function IsRequirequs(source, arguments)
{     
        
         var txtqus =document.getElementById('ctl00_ctn1_panelqustxt');
         var ddlid =document.getElementById('ctl00_ctn1_ddlqus');
        
      var Txtqusdescription='';
       
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtqus")>0)
                {   
                                 
                    Txtqusdescription=elm.value;                    
                }
            }
         }       
         if(ddlid.value == 4)
         {  
             if(Txtqusdescription.length >0)
                 {             
                         arguments.IsValid =true;                            
                        return true;               
                 }
            else 
                    {           
                         arguments.IsValid = false;                                      
                         return false;                            
                    }   
                
         }
        else
         {
                           
                            arguments.IsValid =true;                            
                        return true;   
                           
         }
}

function IsTermsCondition(source, arguments)
{     
       
         var chk =document.getElementById('ctl00_ctn1_chktermscondition');
        
       
           
         if(chk.checked == true)
         {  
           
            arguments.IsValid =true;                            
            return true;  
         }
        else  (chk.checked == false)
         {
            
            arguments.IsValid = false;                                      
           return false; 
                          
         }
}

function memberregisration()
{
  
    var i =document.createTextNode('City Not Listed?');
    document.getElementById('ctl00_ctn1_lblcitychanged').appendChild(i);
}

function ReturnDecimalValue(totprice,decvalue)
{
    var t = "";
    var decvalue1 = 0,decvalue2 = 0;
    var s = "";
    var totprice1 = 0,totprice2 = 0;
    var total =0 ;
    var subtotal = 0;

    t = totprice.toString();
    s = decvalue.toString();
    if ((s.indexOf(".")) != -1)
    {
        decvalue1 = s.split(".")[0];
        decvalue2 = "." + s.split(".")[1];
    }
    else
    {
        decvalue1 = parseInt(s);
    }
    
    if ((t.indexOf(".")) != -1)
    {
        totprice1 = t.split(".")[0];
        totprice2 = "." + t.split(".")[1];
    }
    else
    {
        totprice1 = parseInt(t);
    }
    subtotal = parseFloat(decvalue2) + parseFloat(totprice2);
    total = parseInt(decvalue1) + parseInt(totprice1);
    total = total + subtotal;
    return total;
    
}

function updateprice(ddlctrl,lblctrl,val,curr,hid1,hid2,strPropCurrency,PMarkUp,PBaseRate,
SMarkUp,SBaseRate,HiddenFieldavailbility,HiddenFieldMinimumStay,RowIndex,IsDefault,BaseCurrencyId,
PropertyCurrencyID,SelectedCurrencyID,decPriceInProperty,txtHiddenTotalPriceinProperty,divTotalInProperty,txthidtotprice)
{

    curr='<b>'+curr+'</b>';
    var l = document.getElementById(lblctrl);
    var d = document.getElementById(ddlctrl);
    var v = d.options[d.selectedIndex].value;  
    
     var divTotalPropertyPrice = document.getElementById(divTotalInProperty);
     var txthidtotprice1 = document.getElementById(txthidtotprice);
    
//       if(false==CompareMinstayAvail(RowIndex,HiddenFieldavailbility,HiddenFieldMinimumStay))
//       {
//            d.selectedIndex=0;
//            return false; 
//       }   
       
    if(IsDefault == 'True')
        {
            l.innerHTML = curr + ' ' + RoundNumber(ReturnValue(d.selectedIndex * val));
            divTotalPropertyPrice.value=RoundNumber(ReturnValue(d.selectedIndex * decPriceInProperty));
        }    
    else
        {                        
            l.innerHTML = curr + ' ' + RoundNumber(ReturnValue(v * val)); 
            divTotalPropertyPrice.value=RoundNumber(ReturnValue(v * decPriceInProperty));
        }   
        
                             
    var txthidtotbeds = document.getElementById(hid1);
        if (txthidtotbeds != null)
        {
            var lastctrl;
            var intTotBeds = 0;
            var s="";
            var aTotBeds = txthidtotbeds.value.split('#') ;
	        for ( var i = 0 ; i < aTotBeds.length ; i++ )
	        {
		        if ( aTotBeds[i].length == 0 )
			        continue ;
    			
			    if (i != (aTotBeds.length - 1))
			    {    
			        var ddlctrl = document.getElementById(aTotBeds[i]);
			        if (ddlctrl != null)
			        {
			            s = ddlctrl.options[ddlctrl.selectedIndex].value;
			            intTotBeds = intTotBeds + parseInt(s);
			        }
			    }
		        else
		        {
		            lastctrl = document.getElementById(aTotBeds[i]);
		        }
		    }
		    lastctrl.innerHTML = intTotBeds;
        }
    
    var txthidtotprice = document.getElementById(hid2);
    
    if (txthidtotprice != null)
    {
        var lastpricectrl;
        var intTotPrice = 0;
        var p="";
        var dvalue=0;
        var aTotPrice = txthidtotprice.value.split('#') ;
	    for ( var j = 0 ; j < aTotPrice.length ; j++ )
	    {
		    if ( aTotPrice[j].length == 0 )
			    continue ;
			if (j != (aTotPrice.length - 1))
			{    
			    var lblctrl = document.getElementById(aTotPrice[j]);
			    if (lblctrl != null)
			    {
			        p = lblctrl.innerHTML.split(' ')[1];
  
			        if (parseFloat(p) >= 0)
			        {
			            intTotPrice = ReturnDecimalValue(intTotPrice,p);
			            intTotPrice=ReturnValue(intTotPrice);
			        }
			    }
			}
		    else
		    {
		        lastpricectrl = document.getElementById(aTotPrice[j]);
		    }
		}
   }
		
		
    var HiddenTotalPriceinProperty = document.getElementById(txtHiddenTotalPriceinProperty);
    if (HiddenTotalPriceinProperty != null)
    {
        decPriceInProperty = 0;
        p="";
        dvalue=0;
        var aTotPriceProperty = HiddenTotalPriceinProperty.value.split('#') ;
        
	    for ( var j = 0 ; j < aTotPriceProperty.length ; j++ )
	    {   
		    if ( aTotPriceProperty[j].length == 0 )
			    continue ;
			var divTotalInProperty = document.getElementById(aTotPriceProperty[j]);
	        if(divTotalInProperty !=null)
	        {   
               p = divTotalInProperty.value;
	            if (parseFloat(p) >= 0)
	            {
	                decPriceInProperty = ReturnDecimalValue(decPriceInProperty,p);
	                decPriceInProperty=ReturnValue(decPriceInProperty);
	            }
	        }
         }
     }
     
      // Set Grand Total
	 //alert(txthidtotprice1);        
     if(PropertyCurrencyID==SelectedCurrencyID)
     {
        txthidtotprice1.value = intTotPrice;
        lastpricectrl.innerHTML = curr + ' ' + RoundNumber(intTotPrice);
     }
     else
     {
        txthidtotprice1.value = RoundNumber(decPriceInProperty);
        lastpricectrl.innerHTML = curr + ' ' + RoundNumber(intTotPrice) + '<br/> ' + '(' + strPropCurrency + ' ' + RoundNumber(decPriceInProperty) + ')';
     }
     //alert(txthidtotprice1.value);
}

 
 function PriceToolTip(ddlctrl,lblctrl,val,curr,hid1,hid2,strPropCurrency,PMarkUp,PBaseRate,
SMarkUp,SBaseRate,HiddenFieldavailbility,HiddenFieldMinimumStay,RowIndex,IsDefault,BaseCurrencyId,
PropertyCurrencyID,SelectedCurrencyID,decPriceInProperty,txtHiddenPriceInProperty)
 {
 var ToolTip;
    var l = document.getElementById(lblctrl);
    var d = document.getElementById(ddlctrl);
    var v = d.options[d.selectedIndex].value;  
    
    
    if(IsDefault == 'True')
        {
            ToolTip = strPropCurrency + ' ' + RoundNumber(ReturnValue(d.selectedIndex * decPriceInProperty));
        }    
    else
        {                        
            ToolTip = strPropCurrency + ' ' + RoundNumber(ReturnValue(v * decPriceInProperty)); 
        }     
		
    return tooltip(ToolTip);
 }


function CompareMinstayAvail(IndexValue,HiddenFieldavailbility,HiddenFieldMinimumStay)
{

    var Minimumstaty =  document.getElementById(HiddenFieldMinimumStay);
    var avaibility   =  document.getElementById(HiddenFieldavailbility);    
    var Minstayvalue =  Minimumstaty.value.split('#');       
    var davailbility = avaibility.value.split('#');
         // alert(Minstayvalue[IndexValue]);
         //alert(davailbility[IndexValue]);  
       if(Minstayvalue[IndexValue] <= davailbility[IndexValue])
        {
            return true;
                                    
        }
        else
        {
            alert('For this Room, Minimum Stay require at least ' + Minstayvalue[IndexValue] + ' Days.');
            return false;       
        
        }
}
 

// Create By : Girish Sharma
// Module : Super/ManageOccupancyBands.aspx
// Purpose : to Check Start Range and End Range Comparsion

function StartEndRangeCompareOccupancyBands(source, arguments)
{      
      var intStartRange='';
      var intEndRange='';
      
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtStartRange")>0)
                { 
                    intStartRange=elm.value;
                }
                
                 if(elm.name.indexOf("txtEndRange")>0)
                {  
                    intEndRange=elm.value;
                }
            }
         }
       
         
         
	if(intStartRange.length >0 && intEndRange.length >0)
	    {   
	        if(parseFloat(intEndRange) > parseFloat(intStartRange))
	        {  
	           
	            arguments.IsValid = true;
                return true;
	        }
            else
            {
                arguments.IsValid = false;
                return false;
            } 
       }
       else
       {
          
            arguments.IsValid = true;
                return true;
       }
}


function checkbooking(hidctrl,guests,hid,ofr,CheckOutDate,IsTrueCheckOutDate,IsMaximumNightAllow,MaximumNightPerBooking,IsDefaultMinmumStayAllow,DefaultMininumStay,
TotalNoOfNights,txtHiddenMinimumStay,maxGuests,MaximumPeopleAllow,offerprerequisites,booktotprice,arrivaldate,todaydate,selcurrsign,propcurrsign,txthidtotprice)
{ 
      
            var selectedroomids=',';
            
	        // Minimum Stay Check
            var IsExistLoop=false;
            
            var HiddenMinimumStay= txtHiddenMinimumStay.split('$');
            
            var NoOfRooms=HiddenMinimumStay.length-1;
            for (var irow = 1 ; irow <=NoOfRooms ; irow++ )
	            {   
	                var strMinimumStay =HiddenMinimumStay[irow];   
	                var arrRoomDropdown =strMinimumStay.split('@');   
	                var ddlRoom=document.getElementById(arrRoomDropdown[1]); // Room Dropdown Value
	                var RoomName=arrRoomDropdown[2]; // Room Dropdown Value
	                
	                var IsRoomSelected=ddlRoom.options[ddlRoom.selectedIndex].value;
	               
	                if(IsRoomSelected ==0)
	                continue ;
	                
	                selectedroomids = selectedroomids + arrRoomDropdown[3] + ',';
	                
	                var arrMinimumStay =arrRoomDropdown[0].split('#');   
	                var NoOfColumn=arrMinimumStay.length-1;
	                var AvalibilityDate;
	                var MinimumStay=0;
	                var NextAvalibility=0;
	                for(var icolumn=1;icolumn <=NoOfColumn;icolumn++)
	                {
	                   var strDayWiseMinimumStay= arrMinimumStay[icolumn];
	                   var DayWiseMinimumStay = document.getElementById(strDayWiseMinimumStay);
	                   var strMinimumStay = DayWiseMinimumStay.value.split('%');
        	         
	                   if(strMinimumStay.length==1)
	                    continue ;
	                    
	                     AvalibilityDate=strMinimumStay[0];
	                     MinimumStay=parseFloat(strMinimumStay[1]);
	                     NextAvalibility=parseFloat(strMinimumStay[2]);
	                    
	                    if(MinimumStay>NextAvalibility)
	                    {
	                    
	                        alert("For '" + RoomName + "' " + AvalibilityDate +" minimum stay required " + MinimumStay + " days !");
	                        //IsExistLoop=true;
	                        return false;
	                        //break;
	                    }
	                }  
	            }
         // End Of Minimum Stay Check	
                
    var txtofr = document.getElementById(ofr);
    
    if (IsTrueCheckOutDate == 0) // Check Out Date
    {
       alert(CheckOutDate + ' is NO-CHECKOUT-DATE for our hostel, please select another date');
       return false;
    }
//    if (IsMaximumNightAllow == 0) // MaximumNight Check
//    {
//       alert('Maximum night for our hostel is '+ MaximumNightPerBooking +' nights, please try again !!');
//       return false;
//    }
   
	if (IsDefaultMinmumStayAllow == 0) // Minimum Saty Check
    {
       alert('Minimum stay allow for our hostel is '+ DefaultMininumStay +' days, please try again !!');
       return false;
    }
    
    var selectedoffer= -1;
    if ((txtofr.value != null) && (txtofr.value.length > 0))
    {
        var txthidoffer = document.getElementById(hid);
        var aOffers = txthidoffer.value.split(',') ;
        var oFound =0;
        var strOffer;
        for ( var k = 0 ; k < aOffers.length ; k++ )
        {
            strOffer = aOffers[k];
            if (strOffer.toLowerCase() == txtofr.value.toLowerCase())
            {
                oFound = 1;
                selectedoffer=k;
                break;
            }
        }
        if (oFound == 0)
        {
            alert('This Offer code is not applicable on this Hostel/Hotel/Room Type. Pease select appropriate Hostel/Hotel/Room Type Or please leave the \'Enter Promotion/Offer Code (if any)\' blank to proceed further.');
            return false;
        }
    }
    
    
    if ((txtofr.value != null) && (txtofr.value.length > 0))
    {
    //,booktotprice,arrivaldate,TotalNoOfNights,guests,selectedroomids
        var txthidprereq = document.getElementById(offerprerequisites);
        var aPreReqs = txthidprereq.value.split('%%') ;
        
        //alert(txthidprereq.value);
        if (selectedoffer >=0)
        {
            var blnResult =1;
            var strAlert = 'To avail this offer following requirements should be met:\r\n\r\n';
            for ( var l = 0 ; l < aPreReqs.length ; l++ )
            {
                
                if (selectedoffer == l)
                {
                    var aPreReqsItems = aPreReqs[l].split('^^');

                    var departdate = new Date(arrivaldate);
                    departdate.setDate(departdate.getDate() + (TotalNoOfNights - 1));

                    var currentdate = new Date(todaydate);
                    var bookarrivaldate = new Date(arrivaldate);
                    var bookedstartdate=new Date(aPreReqsItems[0]);
                    var bookedenddate=new Date(aPreReqsItems[1]);
                    var validstartdate=new Date(aPreReqsItems[2]);
                    var validenddate=new Date(aPreReqsItems[3]);
                    
                    //Checking for prerequisites
                    //Checking for booking date//
                    strAlert=strAlert+'You should be booking in between ' + bookedstartdate.getDate() + "/" + (bookedstartdate.getMonth() + 1) + "/" + bookedstartdate.getFullYear() + ' and ' + bookedenddate.getDate() + "/" + (bookedenddate.getMonth() + 1) + "/" + bookedenddate.getFullYear()+'\r\n';
                    strAlert=strAlert+'Your Arrival date and the last date of your stay should be in between ' + validstartdate.getDate() + "/" + (validstartdate.getMonth() + 1) + "/" + validstartdate.getFullYear() + ' and ' + validenddate.getDate() + "/" + (validenddate.getMonth() + 1) + "/" + validenddate.getFullYear()+'\r\n';
                    if (parseInt(aPreReqsItems[4]) == 1)
                    {
                        strAlert=strAlert+'Minimum Nights Required  :  ' + aPreReqsItems[5]+'\r\n';
                    }
                    if (parseInt(aPreReqsItems[6]) == 1)
                    {
                        if (selcurrsign != propcurrsign)
                            strAlert=strAlert+'Minimum Price Required  :  ' + selcurrsign + ' ' + parseFloat(aPreReqsItems[16]) + ' (' + propcurrsign + ' ' + parseFloat(aPreReqsItems[7]) +')\r\n';
                        else
                            strAlert=strAlert+'Minimum Price Required  :  ' + propcurrsign + ' ' + parseFloat(aPreReqsItems[7]) +'\r\n';
                        
                    }
                    if (parseInt(aPreReqsItems[8]) == 1)
                    {
                        strAlert=strAlert+'Minimum People Required  :  ' + aPreReqsItems[9]+'\r\n';
                    }
                    if (parseInt(aPreReqsItems[13]) == 5)
                    {
                        strAlert=strAlert+'Valid for rooms  :  ' + aPreReqsItems[15]+'\r\n';
                    }
                    
                    blnResult = 0;
                    if ((currentdate >= bookedstartdate) && (currentdate <= bookedenddate))
                    {
                        blnResult = 1;                    
                    }
                    else
                    {
                        strAlert=strAlert+'\r\nPlease Note  :  You are not booking in between ' + bookedstartdate.getDate() + "/" + (bookedstartdate.getMonth() + 1) + "/" + bookedstartdate.getFullYear() + ' and ' + bookedenddate.getDate() + "/" + (bookedenddate.getMonth() + 1) + "/" + bookedenddate.getFullYear()+'\r\n';
                    }
                    
                    if (blnResult ==1)
                    {
                        blnResult = 0;
                        //Checking for arrival date
                        if ((bookarrivaldate >= validstartdate) && (departdate <= validenddate))
                        {
                            blnResult = 1;
                        }
                        else
                        {
                            strAlert=strAlert+'\r\nPlease Note  :  Your stay is not in between ' + validstartdate.getDate() + "/" + (validstartdate.getMonth() + 1) + "/" + validstartdate.getFullYear() + ' and ' + validenddate.getDate() + "/" + (validenddate.getMonth() + 1) + "/" + validenddate.getFullYear()+'\r\n';
                        }
                    }

                    if (blnResult ==1)
                    {
                        //checking for is minimum nights required
                        if (parseInt(aPreReqsItems[4]) == 1)
                        {
                            if (TotalNoOfNights < parseInt(aPreReqsItems[5]))
                            {
                                blnResult = 0;
                                strAlert=strAlert+'\r\nPlease Note  :  You are not booking for ' + parseInt(aPreReqsItems[5]) + ' nights\r\n';
                            }
                        }
                    }

                    if (blnResult ==1)
                    {
                        var txthidtotprice = document.getElementById(txthidtotprice);
                       // alert(txthidtotprice.value);
                        //alert(aPreReqsItems[7]);
                        //alert(aPreReqsItems[6]);
                        //alert(parseFloat(txthidtotprice.value) < parseFloat(aPreReqsItems[7]));
                        //checking for is minimum price required
                        if (parseInt(aPreReqsItems[6]) == 1)
                        {
                            //alert(aPreReqsItems[7]);
                            var val1 = parseFloat(txthidtotprice.value);
                            var val2 = parseFloat(aPreReqsItems[7]);
                            //alert('1= '+ val1 + ' 2= '+ val2);
                            if (val1 < val2)
                            {
                                blnResult = 0;
                                if (selcurrsign != propcurrsign)
                                    strAlert=strAlert+'\r\nPlease Note  :  You are having price less than ' + selcurrsign + ' ' + parseFloat(aPreReqsItems[16]) + ' (' + propcurrsign + ' ' + parseFloat(aPreReqsItems[7]) +')\r\n';
                                else
                                
                                    strAlert=strAlert+'\r\nPlease Note  :  You are having price less than ' + propcurrsign + ' ' + parseFloat(aPreReqsItems[7]) +'\r\n';
                            }
                        }
                    }

                    if (blnResult ==1)
                    {
                            //checking for is people price required
                        if (parseInt(aPreReqsItems[8]) == 1)
                        {
                            var intTotBedsOfr = 0;
                            var sOfr;
                            var aTotBedsOfr = document.getElementById(hidctrl).value.split('#') ;
	                        for ( var i = 0 ; i < (aTotBedsOfr.length - 1) ; i++ )
	                        {
		                        if ( aTotBedsOfr[i].length == 0 )
			                        continue ;
                    			
		                        var ddlctrlOfr = document.getElementById(aTotBedsOfr[i]);
		                        if (ddlctrlOfr != null)
		                        {
		                            if (ddlctrlOfr.options.length > 0)
		                            {            
		                                sOfr = ddlctrlOfr.options[ddlctrlOfr.selectedIndex].value;
		                                intTotBedsOfr = intTotBedsOfr + parseInt(sOfr);
		                            }
		                        }
		                    }
                            if (intTotBedsOfr < parseInt(aPreReqsItems[9]))
                            {
                                blnResult = 0;
                                strAlert=strAlert+'\r\nPlease Note  :  You are booking for less than ' + parseInt(aPreReqsItems[9]) + ' people\r\n';
                            }
                        }
                    }

                    if (blnResult ==1)
                    {
                        //checking if offer is limited
                        if (parseInt(aPreReqsItems[10]) == 1)
                        {
                            if (parseInt(aPreReqsItems[11]) >= parseInt(aPreReqsItems[12]))
                            {
                                blnResult = 0;
                                strAlert=strAlert+'\r\nPlease Note  :   Offer already exhausted, you cannot avail this offer anymore.\r\n';
                            }
                        }
                    }

                    
                    if (blnResult ==1)
                    {
                        if (parseInt(aPreReqsItems[13]) == 5)
                        {     
                            var blnFound = 0;                       
                            var strOfferRooms = aPreReqsItems[14];
                            //splitting selected rooms
                            var arRooms = selectedroomids.split(',');
                            
                            for(var r = 0; r < arRooms.length; r++)
                            {
                                if (arRooms[r].length >0)
                                {
                                    if (strOfferRooms.indexOf("," + arRooms[r] + ",") >= 0)
                                    {
                                        blnFound = 1;
                                        break;
                                    }
                                }
                            }
                            if (blnFound == 0)
                            {
                                blnResult = 0;
                                strAlert=strAlert+'\r\nPlease Note  :  You are not booking for valid rooms\r\n';
                            }
                        }
                    }
                    break;
                }
            }
            if (blnResult ==0)
            {
                strAlert=strAlert+'\r\nPlease make necessary changes to avail the offer or please leave the \'Enter Promotional/Offer Code (if any)\' blank to proceed further.\r\n';
                alert(strAlert);
                return false;
            }
        }
    }
    
    var txthidtotbeds = document.getElementById(hidctrl);
    if (txthidtotbeds != null)
    {
        var intTotBeds = 0;
        var s="";
        var isAvailable=0;
        var aTotBeds = txthidtotbeds.value.split('#') ;
	    for ( var i = 0 ; i < (aTotBeds.length - 1) ; i++ )
	    {
		    if ( aTotBeds[i].length == 0 )
			    continue ;
			
		    var ddlctrl = document.getElementById(aTotBeds[i]);
		    if (ddlctrl != null)
		    {
		        if (ddlctrl.options.length > 0)
		        {            
		            s = ddlctrl.options[ddlctrl.selectedIndex].value;
		            intTotBeds = intTotBeds + parseInt(s);
		            isAvailable=1;
		        }
		    }
		}
		if (isAvailable == 1)
		{
            
		    if (intTotBeds == 0)
		    {
		        alert('Please select beds/rooms.');
		        return false;
		    }
//		    else if (MaximumPeopleAllow <intTotBeds) // Maximum People Allow Check
//            {
//                alert('Maximum people allow for our hostel is '+ MaximumPeopleAllow +', please try again !!');
//                return false;
//            }
		    else if (intTotBeds < guests)
		    {
		         return confirm('No. of guests/beds selected are less than the searched i.e. ' + guests + '. Click \'OK\' to proceed and \'Cancel\' to change the selection.');
		    }
		    else if (intTotBeds > guests)
		    { 
		        
		        if (intTotBeds > maxGuests)
		        {
		            return confirm('No. of guests/beds selected are more than the searched i.e. ' + guests + '. If you click \'OK\' to proceed you will be redirected to the group bookings area or click \'Cancel\' to change the selection.');
		        }
		        else
		        {
		            return confirm('No. of guests/beds selected are more than the searched i.e. ' + guests + '. Click \'OK\' to proceed and \'Cancel\' to change the selection.');
		        }
		    }
		    else
		    {   
	                return true;
		    }
		}
		else
		{
		    alert('No availability found, cannot continue, please try for another hostel.');
		    return false;   
		}
		if (intTotBeds > maxGuests)
		{
		    alert('Maximum number of guests for normal bookings is exceeding so you are being redirected to the group bookings area.');
		    return true; 
		}
    }
    else
    {  
        return false;
    }
    
}

function DisplayOfferPreRequisitePopup(nights,price,arrivaldate,guests,selroomids,seloffer,prereqs)
{

}

function viewpopupforannouncementsetting(url)
{
   
    var newwindow; 
    newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=500,width=600,left=300,top=100');
    if (window.focus) {newwindow.focus();}
   return false;
} 


function GroupBookingStartMessage(ddlPeople, maxGuests)
{
        var IsTrue=true;
        var ddlPeople = document.getElementById(ddlPeople);
        var NoOfPeopleSelected=  ddlPeople.options[ddlPeople.selectedIndex].value;
        
        //alert(NoOfPeopleSelected +' ' + maxGuests);
        if (NoOfPeopleSelected == maxGuests)
	      {
	  	     alert('Maximum number of guests for normal bookings is exceeding so you are being redirected to the group bookings area.');
    	     IsTrue=true;
	      }
	      return IsTrue;
}
function GroupBookingStartMessageSearchControl(ddlPeople, maxGuests,ddlCityId,ddlCountryId)
{
    var IsTrue=false;
    var IsCityTrue=false;
    var IsCountryTrue=false;
    var ddlcountry = document.getElementById(ddlCountryId); 
    var ddlcity = document.getElementById(ddlCityId); 
    
       if(ddlcountry !=null)
       {
            if(ddlcountry.value >0)
            {   
                IsCountryTrue= true;
            }
            else
            { 
                IsCountryTrue= false;
            }
        }
     else
        {
            IsCountryTrue= false;
        }
        

     
     if(ddlcity !=null)
     {
        if(ddlcity.value >0)
        {  
            IsCityTrue=true;
        }
        else
        {
            IsCityTrue=false;
        }
     }
      else
        {
           IsCityTrue=false;
        }
        
    if(IsCityTrue==true && IsCountryTrue==true)
    {    
        var ddlPeople = document.getElementById(ddlPeople);
        var NoOfPeopleSelected=  ddlPeople.options[ddlPeople.selectedIndex].value;
        
        //alert(NoOfPeopleSelected +' ' + maxGuests);
        if (NoOfPeopleSelected == maxGuests)
	      {
	  	     alert('Maximum number of guests for normal bookings is exceeding so you are being redirected to the group bookings area.');
    	     IsTrue=true;
	      }
     }	  
	 return IsTrue;
}
       


// Function : viewpopupOptionExtrasDetails
// Create By : Girish Sharma
// Module : Member/Booking.aspx
// Purpose : Show OptionExtrasTerms and Description
function viewpopupOptionExtrasDetails(url,PMID)
{  
    var newwindow; 
    newwindow=window.open(url + '?PMID=' + PMID,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=500,width=600,left=280,top=100');
    if (window.focus) {newwindow.focus();}
   return false;
} 

// Function : viewpopupOffersPrerequisites
// Create By : Girish Sharma
// Module : Member/Booking.aspx
// Purpose : Show OptionExtrasTerms and Description
function viewpopupOffersPrerequisites(url,OFMID,st,PRPMID)
{  
    var newwindow; 
    newwindow=window.open(url + '?of=' + OFMID + '&st=' + st + '&pm=' + PRPMID,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=500,width=600,left=280,top=100');
    if (window.focus) {newwindow.focus();}
   return false;
} 

// Function : ReturnValue
// Create By : Girish Sharma
// Module : Member/booking.aspx
// Purpose : to format number

function ReturnValue(decvalue)
{
    var decvalue1 = 0,decvalue2 = 0;
    var s = "";
    var returnValue = 0;
    s = decvalue.toString();

    if ((s.indexOf(".")) != -1)
    {
        decvalue2 = "." + s.split(".")[1];
        decvalue1 = s.split(".")[0];
        returnValue=decvalue2.substring(0,3)
        decvalue1=decvalue1+returnValue;
    }
    else
    {
        decvalue1 = parseInt(s);
    }
    return decvalue1;
}

function AddProductReview(IdProductName,hfOptionExtrasQuantity,hfOptionExtrasChecked,
hfOptionExtrasText,hfHref,DivProductInput,chkOptionExtras,hfMaxQty)
{

     //Href Page Link
     var IDHref = document.getElementById(hfHref);
     var Href = IDHref.value.split('$') ;
    
     // Option Extra Check Box ID
     var OptionExtrasChecked = document.getElementById(hfOptionExtrasChecked);
     var OptionExtras = OptionExtrasChecked.value.split('#') ;
     // Product Name
     var OptionExtrasText = document.getElementById(hfOptionExtrasText);
     var OptionExtraTextSplit = OptionExtrasText.value.split('#') ;
     // Product Quantity
     var OptionExtrasQuantity = document.getElementById(hfOptionExtrasQuantity);
     var Quantity = OptionExtrasQuantity.value.split('#') ;
     
     var txtMaxQty = document.getElementById(hfMaxQty);
     var MaxQty = txtMaxQty.value.split('#') ;
     var intMaxQty="";
     
     var DivProductName=document.getElementById(IdProductName);
     var ProductHeader="<div class='div-float-left'><div class='div-float-left | div-property-signup-rightside-text | div-bold' style='padding-left:9px;'>Option Extras Selected</div>"+
                             "<div class='clear'>&nbsp;</div>"+
                             "<div class='div-float-left | div-HostelBooking-Heading-red'>Product</div>"+
                             "<div class='div-float-right  | div-HostelBooking-Heading-red' style='padding-left:5px'>Qty</div></div>"+
                             "<div class='clear'>&nbsp;</div>" ; // Select Product Name HTML 
     var SelectedProductName= ''
     
     var NumberOfChecked=0;  
      
      if (OptionExtras != null)
       {
          for ( var i = 0 ; i < OptionExtras.length ; i++ )
	           {
	            if ( OptionExtras[i].length == 0 )
			        continue ;
			    if (i != (OptionExtras.length))
			        {    
			            var OptionExtras1 = document.getElementById(OptionExtras[i]);
			            if (OptionExtras1 != null)
			            {  
		                  if(OptionExtras1.checked)
		                    {
		                       NumberOfChecked=NumberOfChecked + 1;
		                       intQuantity=document.getElementById(Quantity[i]).value;
	                           
	                           intMaxQty=parseInt(MaxQty[i]);
		                       if (intQuantity>0)
		                       {
		                           if (intMaxQty<intQuantity)
		                           {
		                                
		                                alert('Quantity available in stock is ' + intMaxQty.toString() + '.Please enter again !');
		                                document.getElementById(Quantity[i]).value='';
		                                intQuantity=0;
		                                return false;
		                           }
		                           else
		                           {
		                            SelectedProductName =SelectedProductName + "<div class='div-float-left | default-text-bold'>" + "<a href='"+Href[i]+"'>"+
	                                document.getElementById(OptionExtraTextSplit[i]).innerHTML + "</a></div><div class='div-float-right | div-HostelBooking-Heading-red' style='text-align:right;'>" + 
	                               intQuantity + "</div><div class='clear'>&nbsp;</div>";
		                           }
		                       }
		                    }
		                    else
		                    {
		                       if(NumberOfChecked != 0)
		                       NumberOfChecked=NumberOfChecked -1;
		                    }
		                 }
		             }
		       }
	    }
	    if(SelectedProductName=='')
	    {
	        ProductHeader='';
	    }
	    
	    GroupBookingShowProductInput(DivProductInput,chkOptionExtras);
	    DivProductName.innerHTML=ProductHeader + ' ' + SelectedProductName;
}

// Function : OptionExtrasValue
// Create By : Girish Sharma
// Module : Member/booking.aspx
// Purpose : to bind OptionExtras Name and Price

function OptionExtrasValue(hfOptionExtrasChecked,hfOptionExtrasPrice,DivOptionExtraText,hfOptionExtrasText,
hfOptionExtrasQuantity,CurrencySign,CheckedOptionExtras,hfProductID,PMID,hfLoyalty,lblOpExtra,DivProductInput,
chkOptionExtras,DivMessage,DivProductName,DivGrandTotal,hfIsPayDepositProduct,DepositPercent,
AccommodationAmount,hfMultiLevelprice,hfTotalPayNow,hfPayNowProduct,hfMaxQty)
{   
    // Id Pay Deposit
    var IsPayDepositProduct=document.getElementById(hfIsPayDepositProduct).value.split('#') ;
    // Get MultiLevel Price
    var IDMultiLevelprice=document.getElementById(hfMultiLevelprice);
    var MultiLevelprice = IDMultiLevelprice.value.split('$') ;
         
    var LoyaltyField = document.getElementById(hfLoyalty);
    var LoyaltyPoints;
    if (LoyaltyField != null)
        LoyaltyPoints = LoyaltyField.value.split('#') ;
    
    var OptionExtraLoyaltyLabel = document.getElementById(lblOpExtra);
    if (OptionExtraLoyaltyLabel != null)
        OptionExtraLoyaltyLabel.innerHTML = 0;
    
     var OptionExtrasChecked = document.getElementById(hfOptionExtrasChecked);
     var OptionExtras = OptionExtrasChecked.value.split('#') ;
     
     var DivTextOptionExtra = document.getElementById(DivOptionExtraText);
     
     var OptionExtrasText = document.getElementById(hfOptionExtrasText);
     var OptionExtraTextSplit = OptionExtrasText.value.split('#') ;
     var Text='';
     
     var OptionExtrasPrice = document.getElementById(hfOptionExtrasPrice);
     var Price = OptionExtrasPrice.value.split('#') ;
     
     var OptionExtrasQuantity = document.getElementById(hfOptionExtrasQuantity);
     var Quantity = OptionExtrasQuantity.value.split('#') ;
     
     var txtMaxQty = document.getElementById(hfMaxQty);
     var MaxQty = txtMaxQty.value.split('#') ;
       
     var intPrice="";
     var intQuantity="";
     var intMaxQty="";
     var TotalPrice=0;
     var Returnvalue=0;
     var GrandTotal=0;
     var TotalLoyaltyPoint=0;
                         
     var NumberOfChecked=0;            
     // Product Variables
     var DivMessageID = document.getElementById(DivMessage);
     var SelectedProductName=''; // Select Product Name HTML
     var SelectedProductPrice=''; // Select Product Price HTML
     var strProductTotal='';// Product Total With HTML
     var ProductName= document.getElementById(DivProductName);
     var DivProductTotal= document.getElementById(DivGrandTotal);
     var DepositPercent; // Percent Amount To Paid
     
     // *** //
     if (OptionExtras != null)
       {
          for ( var i = 0 ; i < OptionExtras.length ; i++ )
	           {
	            if ( OptionExtras[i].length == 0 )
			        continue ;
			    if (i != (OptionExtras.length))
			        {    
			            var OptionExtras1 = document.getElementById(OptionExtras[i]);
			            if (OptionExtras1 != null)
			            {  
		                  if(OptionExtras1.checked)
		                    {
		                        //alert('1');
		                       NumberOfChecked=NumberOfChecked + 1;
		                       intPrice=parseFloat(document.getElementById(Price[i]).innerHTML);
		                       intQuantity=document.getElementById(Quantity[i]).value;
		                       
		                       intMaxQty=parseInt(MaxQty[i]);
		                       if (intQuantity>0)
		                       {
		                           if (intMaxQty<intQuantity)
		                           {
		                                
		                                alert('Quantity available in stock is ' + intMaxQty.toString() + '.Please enter again !');
		                                document.getElementById(Quantity[i]).value='';
		                                return false;
		                           }
		                       }
		                        
		                       // MultiLevel Price
                               var ProductPrice=GetProductPrice(MultiLevelprice[i],intQuantity,intPrice);
                             
		                       Returnvalue=ProductPrice * intQuantity;
		                       TotalPrice = ReturnValue(Returnvalue);
                               // alert(IsPayDepositProduct[i]);
    	                         if(IsPayDepositProduct[i]=='True') // Get Only Defined Percent Of Amount
    	                         {
                                    TotalPrice=(DepositPercent / 100) * TotalPrice;
                                 }
    	                        
    	                         GrandTotal=ReturnDecimalValue(GrandTotal , TotalPrice);
    	                      
	                            SelectedProductName =SelectedProductName + "<div class='div-float-left'>" + 
	                            document.getElementById(OptionExtraTextSplit[i]).innerHTML + "</div><div class='clear'>&nbsp;</div>";

	                            SelectedProductPrice =SelectedProductPrice + "<div class='div-float-right | div-HostelBooking-Heading-red' style='text-align:left;'>" + 
	                            CurrencySign + '' + RoundNumber(TotalPrice) + "</div><div class='clear'>&nbsp;</div>";
		                            
		                        DivMessageID.style.display = 'block'; 
		                                   
		                        if (LoyaltyField != null)  
		                            TotalLoyaltyPoint = TotalLoyaltyPoint + parseInt(LoyaltyPoints[i]); 
                                  
		                    }
		                    else
		                    {
		                       if(NumberOfChecked != 0)
		                       
		                       NumberOfChecked=NumberOfChecked -1;
		                      //  DivMessageID.style.display = 'none'; 
		                      // Clear Quantity If Product Deselect
		                       document.getElementById(Quantity[i]).value='';
		                    }
			            }
			        }
	           }
	           document.getElementById(hfPayNowProduct).value=GrandTotal;
	           GrandTotal =GrandTotal + parseFloat(AccommodationAmount);
	           strProductTotal="<div class='div-float-left'>"+
	                                "<div class='div-float-left' style='width:250px;padding-left:2px;padding-right:3px;'>"+
	                                    "<hr style='color:#333333;border:solid 1px;'>"+
	                                "</div>" + 
	                            "<div class='clear'>&nbsp;</div>"+
	                                "<div class='div-HostelBooking-Heading-red'>"+
	                                    "<div class='div-float-left' style='width:40px;'>Total</div>" + 
	                                    "<div class='div-float-right' style='text-align:left;border1px solid red;padding-right:15px;'>" + CurrencySign +''+RoundNumber(GrandTotal) + "</div>"+
	                                "</div>"+
	                            "</div>";
	           ProductName.innerHTML = SelectedProductName;
	           DivTextOptionExtra.innerHTML = SelectedProductPrice;
	           DivProductTotal.innerHTML = strProductTotal;
	           document.getElementById(hfTotalPayNow).value=GrandTotal;
       }
       
       if (LoyaltyField != null)
       {
           if (OptionExtraLoyaltyLabel != null)
            {                                
                OptionExtraLoyaltyLabel.innerHTML=TotalLoyaltyPoint;
            }	
        }
                
//    var CheckedOption = document.getElementById(CheckedOptionExtras);
//    var ProductID = document.getElementById(hfProductID);
//    if (ProductID != null)
//    {
//        var strPMID=ProductID.value;
//       
//        if(CheckedOption.checked)
//        {
//            if(strPMID.search(','+PMID+',')==-1)
//            {
//                //Not Found inside string
//                ProductID.value=ProductID.value +PMID +',';
//            }
//        }
//        else
//        {
//            ProductID.value=strPMID.replace(PMID+',','');
//        }
//    }
    GroupBookingShowProductInput(DivProductInput,chkOptionExtras);
    
}


function GetProductPrice(hfProductMultiLevelPrice,Quantity,ProductPrice)
{
    var IdhfMultiLevelPrice= document.getElementById(hfProductMultiLevelPrice);
    var ArrPriceQuantity=IdhfMultiLevelPrice.value.split('#') ; // Split Price By ID
    var PPrice=0;
    var PQuantity=0;
    var intTempQty=0;
    for(var Irow=0;Irow < ArrPriceQuantity.length-1;Irow++)
    {
       var ArrPriceQty=ArrPriceQuantity[Irow].split("%");
       intTempQty=intQty
       var intQty=parseInt(ArrPriceQty[1]);
       var intPrice=parseFloat(ArrPriceQty[0]);
       
       if(parseInt(Quantity)==intQty)
       {
        ProductPrice=intPrice;
        break;
       }
       else if(parseInt(Quantity) > intQty )
       {
        ProductPrice=intPrice;
       }
    }
    return ProductPrice;
}

function IsPaymentDetailTermsCondition(source, arguments)
{     
       
     var chk =document.getElementById('ctl00_ctn1_chkAgreeTerms');
     if(chk.checked == true)
     {  
        arguments.IsValid =true;                            
        return true;  
     }
    else  (chk.checked == false)
     {  
        arguments.IsValid = false;                                      
        return false; 
     }
}


function IsIssueNoRequired(source, arguments)
{     
       
     var ddlCardType =document.getElementById('ctl00_ctn1_ddlCardType');
     var IssueNo =document.getElementById('ctl00_ctn1_EbizTxtIssueNo');
     
     
     
     if(ddlCardType.value=='6' || ddlCardType.value=='8') // Switch Card and Maestro Card
     {
        if(_slsTrim(IssueNo.value) != "")
        {
            arguments.IsValid =true;                            
            return true;  
        }
        else
        {
            arguments.IsValid = false;                                      
            return false; 
        }
     }  
     else
     {
        arguments.IsValid = true;                                      
        return true; 
     }
    
}



function IsPayNowIssueNoRequired(source, arguments)
{     
       
     var ddlCardType =document.getElementById('ctl00_ctn1_ddlCardType');
     var IssueNo =document.getElementById('ctl00_ctn1_txtissueno');
     
     
     if(ddlCardType.value=='6' || ddlCardType.value=='8') // Switch Card and Maestro Card
     {
        if(_slsTrim(IssueNo.value) != "")
        {
            arguments.IsValid =true;                            
            return true;  
        }
        else
        {
            arguments.IsValid = false;                                      
            return false; 
        }
     }  
     else
     {
        arguments.IsValid = true;                                      
        return true; 
     }
    
}
// Created By : Girish Sharma
// Created Date : 9-10-2007
// Function : IsConfirmBooking()
// Input : hfIsMemberRegistred
// Module : Member/Booking.aspx
// Return : String
// Purpose : To set HiddenField Value in case on Member Book Hostel without Registration

function IsConfirmBooking(hfIsMemberRegistred)
{
   var IsTrue=window.confirm("Would you like to register on the site ?");
   var IsMemberRegistred = document.getElementById(hfIsMemberRegistred);
    if (IsTrue)
    {  
        IsMemberRegistred.value="1";
    }   
    else
    {
        IsMemberRegistred.value="0";
    }   
}

// Created By : Girish Sharma
// Created Date : 9-10-2007
// Function : GroupAdminOptionExtrasSelected()
// Input : hfIsMemberRegistred
// Module : Member/Grpbook3.aspx
// Return : String
// Purpose : To set HiddenField Value in case on Member Book Hostel without Registration
function GroupAdminOptionExtrasSelected(CheckedOptionExtras,hfProductID,PMID,chkihaveFilled)
{
    var CheckedOption = document.getElementById(CheckedOptionExtras);
    var IsIhaveFilled = document.getElementById(chkihaveFilled);
    var ProductID = document.getElementById(hfProductID);
    if (ProductID != null)
    {
        var strPMID=ProductID.value;
       
        if(CheckedOption.checked)
        {
            if(strPMID.search(','+PMID+',')==-1)
            {
                //Not Found inside string
                ProductID.value=ProductID.value +PMID +',';
            }
         
        }
        else
        {
            ProductID.value=strPMID.replace(PMID+',','');
        }
        
//            var PMIDLength=trim(ProductID.value);
//            if(PMIDLength !=null)
//            {
//                IsIhaveFilled.disabled=false;
//            }
//            else
//            {
//                IsIhaveFilled.disabled=true;
//                IsIhaveFilled.checked=false;
//            }
        
    }
}

function IsHaveFillAllInProductInformation(source, arguments)
{     
       
     var chk =document.getElementById('ctl00_ctn1_chkihaveFilled');
     var IsProductChecked =document.getElementById('ctl00_ctn1_hfProductID');
     if(IsProductChecked.value.length >=0)
     {  
        arguments.IsValid =true;                            
        return true;  
     }
    else // (chk.checked == false)
     {  
        arguments.IsValid = false;                                      
        return false; 
     }
}

// Created By : Girish Sharma
// Created Date : 9-10-2007
// Function : trim()
// Input : String
// Return : String

function trim(str)
{
    if(!str || typeof str != 'string')
        return null;

    return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
}

// Created By : Girish Sharma
// Created Date : 10-10-2007
// Function : ConvertCurrency()
// Input : 
// Module : Member/BookingSearch.aspx
// Return : 
// Purpose : To Convert All Currency by User define selection in HostelList page

function ConvertCurrency(CurrencyID,hfBasePrivatePrice,hfBaseSharedPrice,hfPrivatePrice,hfSharedPrice,hfPrivateCurrencySign,hfSharedCurrencySign,hfPropertySharedPrice,hfPropertyPrivatePrice,hfPropertyCurrencyId,BaseCurrencyId,hfPropertyCurrencyMarkup,hfPropertyCurrencyBaseRate)
{

    var Currency = document.getElementById(CurrencyID);
    var CurrencyIDValue= Currency.value.split('#');
    if(Currency.value != 0)
    {
            var ConversionRate=CurrencyIDValue[0];
            var CurrencySign=CurrencyIDValue[1];
            var MarkupRate=CurrencyIDValue[2];
            var SelectedCurrencyId=CurrencyIDValue[3];
            
             
            //alert(CurrencySign +' '+ ConversionRate + ' '+MarkupRate);
            var NumberOfRecord;
           
            // Get Currency Sign Private Price and Shared
            var PrivateCurrencySignID=document.getElementById(hfPrivateCurrencySign);
            var PrivateCurencySign = PrivateCurrencySignID.value.split('%') ; 
            var SharedCurrencySignID=document.getElementById(hfSharedCurrencySign);
            var SharedCurencySign = SharedCurrencySignID.value.split('%') ; 
            
            // Get Private and Shared Room Price
            var hfBasePrivatePriceID=document.getElementById(hfBasePrivatePrice);
            var BasePrivatePrice = hfBasePrivatePriceID.value.split('%') ;
            var hfBaseSharedPriceID=document.getElementById(hfBaseSharedPrice);
            var BaseSharedPrice = hfBaseSharedPriceID.value.split('%') ;
             
            // Get Labe For Set Selected Shared and Private Price for Selected Currency
            var hfPrivatePriceID=document.getElementById(hfPrivatePrice);
            var PrivatePrice = hfPrivatePriceID.value.split('%') ; 
            var hfSharedPriceID=document.getElementById(hfSharedPrice);
            var SharedPrice = hfSharedPriceID.value.split('%') ; 
            
            
             // Get Property Private and Shared Room Price
            var hfPropertyPrivatePriceID=document.getElementById(hfPropertyPrivatePrice);
            var PropertyPrivatePrice = hfPropertyPrivatePriceID.value.split('%') ;
            var hfPropertySharedPriceID=document.getElementById(hfPropertySharedPrice);
            var PropertySharedPrice = hfPropertySharedPriceID.value.split('%') ;
            
           // Get Property Currency Id
             var hfPropertyCurrency=document.getElementById(hfPropertyCurrencyId);
             var PropertyCurrency = hfPropertyCurrency.value.split('%') ;
            
           // Get Property Currency Markup and Base Rate
            var hfPropertyCurrencyMarkupID=document.getElementById(hfPropertyCurrencyMarkup);
            var PropertyCurrencyMarkup = hfPropertyCurrencyMarkupID.value.split('%') ;
            var hfPropertyCurrencyBaseRateID=document.getElementById(hfPropertyCurrencyBaseRate);
            var PropertyCurrencyBaseRate = hfPropertyCurrencyBaseRateID.value.split('%') ;
            
            
            NumberOfRecord=BasePrivatePrice.length-1;
            var PrivateBasePrice=0;
            var SharedBasePrice=0;
            var TotalPrivateRate=0;
            var TotalSharedRate=0;
            var PropertyCurrencyId=0;
            var PropertyBaseRate=0;
            var PropertyMarkup=0;
            for( var i = 0 ; i < NumberOfRecord ; i++ )
               {
                   if ( NumberOfRecord == 0 )
	                    continue ;
                       
                       //
                        //alert(document.getElementById(PropertyPrivatePrice[i]).innerHTML);
                        PrivateBasePrice=parseFloat(document.getElementById(PropertyPrivatePrice[i]).innerHTML);
                        SharedBasePrice=parseFloat(document.getElementById(PropertySharedPrice[i]).innerHTML);
                        //alert(document.getElementById(PropertySharedPrice[i]).innerHTML);
                        
                        PropertyCurrencyId=PropertyCurrency[i];
                        PropertyMarkup=PropertyCurrencyMarkup[i];
                        PropertyBaseRate=PropertyCurrencyBaseRate[i];
                       //
	                   //PrivateBasePrice=parseFloat(document.getElementById(BasePrivatePrice[i]).value);
	                   //SharedBasePrice=parseFloat(document.getElementById(BaseSharedPrice[i]).value);
	                  
	                   // Private Room Price
                       //TotalPrivateRate=PropertyCurrencyToBaseCurrency(PrivateBasePrice,ConversionRate,MarkupRate);
                       TotalPrivateRate=GetRoomAmount(PrivateBasePrice,ConversionRate,MarkupRate,PropertyCurrencyId,BaseCurrencyId,SelectedCurrencyId,PropertyMarkup,PropertyBaseRate);
	                   document.getElementById(PrivatePrice[i]).innerHTML=TotalPrivateRate
	                   
	                   // Shared Room Price
                       //TotalSharedRate=PropertyCurrencyToBaseCurrency(SharedBasePrice,ConversionRate,MarkupRate);
                       TotalSharedRate=GetRoomAmount(SharedBasePrice,ConversionRate,MarkupRate,PropertyCurrencyId,BaseCurrencyId,SelectedCurrencyId,PropertyMarkup,PropertyBaseRate);
	                   document.getElementById(SharedPrice[i]).innerHTML=TotalSharedRate
                          
                       document.getElementById(PrivateCurencySign[i]).innerHTML=CurrencySign +" ";
                       document.getElementById(SharedCurencySign[i]).innerHTML=CurrencySign +" ";
	           } 
	 }          
}


// Created By : Girish Sharma
// Created Date : 10-03-2008
// Function : GetRoomAmount()
// Input : 
// Module : 
// Return : 
// Purpose : Conver Currency Property To Base

function GetRoomAmount(Amount,BaseRate,Markup,PropertyCurrencyId,BaseCurrencyId,SelectedCurrencyId,PropertyMarkup,PropertyBaseRate)
{
    var Case=0;
    var ConvertedAmount=0;
   if(PropertyCurrencyId !=BaseCurrencyId && BaseCurrencyId !=SelectedCurrencyId && PropertyCurrencyId !=SelectedCurrencyId)
    {
        Case=1;
        ConvertedAmount=PropertyCurrencyToBaseCurrency(Amount,PropertyBaseRate,PropertyMarkup);
        ConvertedAmount=BaseCurrencyToSelectedCurrency(ConvertedAmount,BaseRate,Markup);
        //alert(Amount+'Base='+PropertyBaseRate +' ' + PropertyMarkup);
    }
    else if(PropertyCurrencyId ==BaseCurrencyId && BaseCurrencyId !=SelectedCurrencyId && PropertyCurrencyId !=SelectedCurrencyId)
    {
        Case=2;
        ConvertedAmount=BaseCurrencyToSelectedCurrency(Amount,BaseRate,Markup);
        
        //alert(Amount+'Base='+PropertyBaseRate +' ' + PropertyMarkup);
        
    }
    else if(PropertyCurrencyId !=BaseCurrencyId && BaseCurrencyId ==SelectedCurrencyId && PropertyCurrencyId !=SelectedCurrencyId)
    {
        Case=3;
        ConvertedAmount=PropertyCurrencyToBaseCurrency(Amount,PropertyBaseRate,PropertyMarkup);
    }
    else if(PropertyCurrencyId !=BaseCurrencyId && BaseCurrencyId !=SelectedCurrencyId && PropertyCurrencyId ==SelectedCurrencyId)
    {
        Case=4;
        //ConvertedAmount=PropertyCurrencyToBaseCurrency(Amount,PropertyBaseRate,PropertyMarkup);
        ConvertedAmount=Amount;
    }
    else if(PropertyCurrencyId ==BaseCurrencyId && BaseCurrencyId ==SelectedCurrencyId && PropertyCurrencyId ==SelectedCurrencyId)
    {
        Case=5;
        ConvertedAmount=Amount;
        
       
    }
     //alert(Case);
    return RoundNumber(ConvertedAmount);
    
}

// Created By : Girish Sharma
// Created Date : 10-03-2008
// Function : PropertyCurrencyToBaseCurrency()
// Input : 
// Module : M
// Return : 
// Purpose : Conver Currency Property To Base

function PropertyCurrencyToBaseCurrency(PropertyAmount,PropertyBaseRate,PropertyMarkup)
{

    var AmountBaseCurrency=0;
    AmountBaseCurrency=PropertyAmount * ((1/PropertyBaseRate) + ((1/PropertyBaseRate)*(PropertyMarkup/100)));
   //alert(PropertyAmount + '*' +'((1/'+PropertyBaseRate+')'+ '+' + '((1/'+PropertyBaseRate+')*('+PropertyMarkup+'/100))');
    return AmountBaseCurrency;
}

// Created By : Girish Sharma
// Created Date : 10-03-2008
// Function : BaseCurrencyToSelectedCurrency()
// Input : 
// Module : M
// Return : 
// Purpose : Conver Currency Base To Selected
function BaseCurrencyToSelectedCurrency(BaseCurrencyAmount,SelectCurrencyBaseRate,SelectedCurrencyMarkup)
{
    var AmountSelectedCurrency=0;
    AmountSelectedCurrency=BaseCurrencyAmount * (parseFloat(SelectCurrencyBaseRate) + parseFloat(SelectCurrencyBaseRate * (SelectedCurrencyMarkup/100)));
   // alert(BaseCurrencyAmount +'*' +'('+ SelectCurrencyBaseRate + '+' + '(' + SelectCurrencyBaseRate + '*' + '(' + SelectedCurrencyMarkup + '/' + '100))');
    return AmountSelectedCurrency;
}

// Created By : Girish Sharma
// Created Date : 10-03-2008
// Function : RoundNumber()
// Input : 
// Module : M
// Return : 
// Purpose : Round A Number in Two Palce Decimal
function RoundNumber(rnum) {
	
	var rlength = 2; // The number of decimal places to round to
	if (rnum > 8191 && rnum < 10485) {
		rnum = rnum-5000;
		var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
		newnumber = newnumber+5000;
	} else {
		var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
	}
	
	return FormatNumber(newnumber,2);
}

function FormatNumber(myNum, numOfDec) 
{ 
    var decimal = 1 
    for(i=1; i<=numOfDec;i++) 
    decimal = decimal *10 

    var myFormattedNum = (Math.round(myNum * decimal)/decimal).toFixed(numOfDec) 
    return(myFormattedNum) 
} 


function addToFavorites() 
{ 
    var urlAddress = window.location.href;
    var pageName = window.document.title;
   
   
    if (window.sidebar)
    {
        window.sidebar.addPanel(pageName, urlAddress,"");    
    }
    else if (window.external) 
    { 
        window.external.AddFavorite(urlAddress,pageName);
    }
    else if (window.opera)
    {
        return true;    
    }
    else
    { 
        alert("Sorry! Your browser doesn't support this function."); 
    } 
}

// Created By : Girish Sharma
// Created Date : 11-10-2007
// Function : OpenPopupWithBKMRef()
// Input : PRPMID,ArrivalDate
// Module : Member/Popup/CompareHostel.aspx
// Return : 
// Purpose : Open Popup Hostel List for Compare Hostel
function OpenPopupWithBKMRef(url,bkmref,type,sid)
{
    var w=500;
    var h=500;
    var t=50;
    var l=50;
    var maxWidth=500;
    var maxHeight=300;
    if (document.all) 
    {
    maxWidth=screen.availWidth;
    maxHeight=screen.availHeight;
    }

    if (w > maxWidth) { w=maxWidth }
    if (h > maxHeight) { h=maxHeight }
    //l=(maxWidth-w)/2
    //t=(maxHeight-h)/2
  
    l=100;
    t=100;
    window.open(url + '?id='+ sid + '&ref=' + bkmref + '&type=' + type,"name","height="+h+",width="+w+",top="+t+",left="+l+",resizable=no,scrollbars=no");	
    //window.open(url + '?PRPMID=' + CheckProperty.value+'-1' +'&ArrivalDate=' + ArrivalDate,"name",'toolbar=no,location=0,resizable=no,menubar=no,scrollbars=no,height=500,width=600,left=280,top=100');	
    return false;
} 


// Created By : Girish Sharma
// Created Date : 11-10-2007
// Function : 
// Module : Member/Popup/Affiliate.aspx
// Return : 
function OpenPopupAffiliate(url,afdid)
{
    var w=400;
    var h=300;
    var t=50;
    var l=200;
    var maxWidth=400;
    var maxHeight=200;
    if (document.all) 
    {
    maxWidth=screen.availWidth;
    maxHeight=screen.availHeight;
    }

    if (w > maxWidth) { w=maxWidth }
    if (h > maxHeight) { h=maxHeight }
    //l=(maxWidth-w)/2
    //t=(maxHeight-h)/2
  
    l=200;
    t=100;
    window.open(url + '?afdid='+ afdid ,"name","height="+h+",width="+w+",top="+t+",left="+l+",resizable=no,scrollbars=no");	
    return false;
} 

// Created By : Girish Sharma
// Created Date : 11-10-2007
// Function : CompareHostelPopup()
// Input : PRPMID,ArrivalDate
// Module : Member/Popup/CompareHostel.aspx
// Return : 
// Purpose : Open Popup Hostel List for Compare Hostel
function CompareHostelPopup(url,hfCheckProperty,ArrivalDate,NoOfNight)
{
  
     var CheckProperty = document.getElementById(hfCheckProperty);
     var AdvertisorId='';
     var IsTrue=false;
     var maximumlength = parseInt(CheckProperty.value.length);
    if(CheckProperty.value == '')
    {  
       IsTrue= true;
    }
    if(IsTrue==false)
    {
         AdvertisorId=CheckProperty.value;
         
         if(AdvertisorId.endsWith(","))
         {  
            AdvertisorId = AdvertisorId.substring(0, maximumlength-1);
            
         }
         var Advertisor = AdvertisorId.split(',') ;
         if(Advertisor.length >1)
         {
            IsTrue= false;
         }
         else
         {
            IsTrue= true;
         }
    }
    if(IsTrue)
    {
        alert('Please select more than one hostel to compare');
    }
    else
    {    
        var w=830;
        var h=400;
        var t=50;
        var l=50;
        var maxWidth=850;
        var maxHeight=400;
        if (document.all) 
        {
            maxWidth=screen.availWidth;
            maxHeight=screen.availHeight;
        }

        if (w > maxWidth) { w=maxWidth }
        if (h > maxHeight) { h=maxHeight }
       
        l=100;
        t=100;
        window.open(url + '?PRPMID=' + CheckProperty.value+'-1' +'&ArrivalDate=' + ArrivalDate +'&Night=' + NoOfNight,"name","height="+h+",width="+w+",top="+t+",left="+l+",resizable=no,scrollbars=yes");	
        return false;
    }
    return false;
    
//    var CheckProperty = document.getElementById(hfCheckProperty);
//    if(CheckProperty.value !='')
//    {
//        alert(CheckProperty.value)
//            var w=830;
//            var h=400;
//            var t=50;
//            var l=50;
//            var maxWidth=850;
//            var maxHeight=400;
//            if (document.all) 
//            {
//            maxWidth=screen.availWidth;
//            maxHeight=screen.availHeight;
//            }

//            if (w > maxWidth) { w=maxWidth }
//            if (h > maxHeight) { h=maxHeight }
//            //l=(maxWidth-w)/2
//            //t=(maxHeight-h)/2
//          
//            l=100;
//            t=100;
//            window.open(url + '?PRPMID=' + CheckProperty.value+'-1' +'&ArrivalDate=' + ArrivalDate +'&Night=' + NoOfNight,"name","height="+h+",width="+w+",top="+t+",left="+l+",resizable=no,scrollbars=yes");	
//            //window.open(url + '?PRPMID=' + CheckProperty.value+'-1' +'&ArrivalDate=' + ArrivalDate,"name",'toolbar=no,location=0,resizable=no,menubar=no,scrollbars=no,height=500,width=600,left=280,top=100');	
//            return false;
//	}
//	else
//	{
//	    alert('Please select Hostel.');
//	    return false;
//	}
} 

// Created By : Girish Sharma
// Created Date : 11-10-2007
// Function : CheckedHostel()
// Input : chkHostelName,hfCheckProperty,PRPMID
// Module : Member/BookingSearch.aspx
// Return : 
// Purpose : Set IsProperty Check or not, value in Hidden field with comma seperated
            //which Property checked for compareing Hostel Price and facility
function CheckedHostel(chkHostelName,hfCheckProperty,PRPMID)
{
    var chkHostel = document.getElementById(chkHostelName);
    var CheckProperty = document.getElementById(hfCheckProperty);
    var strPRPMID=CheckProperty.value;
    if(chkHostel.checked)
    {
        if(strPRPMID.search(','+PRPMID+',')==-1)
        {
            //Not Found inside string
            CheckProperty.value=CheckProperty.value +PRPMID +',';
        }
       //else
       //{    
            //found
       //}
       
    }
    else
    {
        CheckProperty.value=strPRPMID.replace(PRPMID+',','');
    }
}


// Created By : Girish Sharma
// Created Date : 11-10-2007
// Function : CheckedHostel()
// Input : chkHostelName,hfCheckProperty,PRPMID
// Module : Member/BookingSearch.aspx
// Return : 
// Purpose : Set IsProperty Check or not, value in Hidden field with comma seperated
            //which Property checked for compareing Hostel Price and facility
function viewProductInputPopup(url,ProductID)
{
    
    var PMID=document.getElementById(ProductID).value;
    var Length=trim(PMID);
    if(Length !=null)
    {
        var newwindow; 
        newwindow=window.open(url + '?PMID='+PMID,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=600,width=700');
        if (window.focus) {newwindow.focus();}
    }
    else
    {
        alert('Please select Option extras for fill product inputs.');
    }
} 


// Created By : Girish Sharma
// Created Date : 11-10-2007
// Function : viewGroupBookingProductInputPopup()
// Input : chkHostelName,hfCheckProperty,PRPMID
// Module : Member/Grpbook3.aspx
// Return : 
// Purpose : Set IsProperty Check or not, value in Hidden field with comma seperated
            //which Property checked for compareing Hostel Price and facility
function viewGroupBookingProductInputPopup(url,ProductID)
{
    
    var PMID=document.getElementById(ProductID).value;
    var Length=trim(PMID);
    if(Length !=null)
    {
        var newwindow; 
        newwindow=window.open(url + '?PMID='+PMID,'name1','toolbar=no,location=0,menubar=no,scrollbars=no,height=600,width=700');
        if (window.focus) {newwindow.focus();}
    }
    else
    {
        alert('Please select Option extras for fill product inputs.');
    }
} 

function HideCreditCardPanel()
{
    var pnlCredCard=document.getElementById('ctl00_ctn1_pnlCreditCart');
    var ddlPayMethod= document.getElementById('ctl00_ctn1_ddlPaymentMethod');
    alert(pnlCredCard);
    if(ddlPayMethod.value >2)
    { 
        pnlCredCard.style.display = "none";
    }
    else
    {
        pnlCredCard.style.display = "";
    }               
    return true;
}

// Created By : Girish Sharma
// Created Date : 11-10-2007
// Function : viewGroupBookingConfirmPopUp()
// Input : url
// Module : Popup/Popup_GrpBookPopup.aspx
// Return : 
// Purpose :Open Popup for Group Booking
function viewGroupBookingConfirmPopUp(url)
{   
        var newwindow; 
        newwindow=window.open(url,'name1','toolbar=no,location=0,menubar=no,scrollbars=no,height=600,width=700,left=220,top=80');
        if (window.focus) {newwindow.focus();}
        return false;
} 


// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : AddTotalNumberOfPeople()
// Input : Number Of Adults, Number Of Children, Total People in Group ClientID
// Module : Member/Grpbook1.aspx
// Purpose : To Display Total Number Of People in Total People in Group Field
function AddTotalNumberOfPeople(EBizTxtNoOfAdults,EBizTxtNoOfChildren,lblTotalPeopleInGroup)
{  
   var NoOfAdults=document.getElementById(EBizTxtNoOfAdults);
   var NoOfChildren=document.getElementById(EBizTxtNoOfChildren);
   var TotalPeople=document.getElementById(lblTotalPeopleInGroup);
   var Adults=0;
   var Children=0;
   var Total=0;
           if(NoOfAdults.value.length >0)
           {
            Adults=parseFloat(NoOfAdults.value);
           }
           else
           {
            Adults=0;
           }
   
          if(NoOfChildren.value.length >0)
            {
              Children=parseFloat(NoOfChildren.value);
            }
           else
           {
            Children=0;
           }
 
   Total=Adults + Children;
   TotalPeople.innerHTML =Total;
}

// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : IsTermsConditionGroupBooking()
// Input : Is Terms condition true
// Module : Member/Grpbook2.aspx
// Purpose : 
function IsTermsConditionGroupBooking(source, arguments)
{      
     var chk =document.getElementById('ctl00_ctn1_chkAcceptGroupBooking');
     if(chk.checked == true)
     {  
        arguments.IsValid =true;                            
        return true;  
     }
    else  (chk.checked == false)
     {  
        arguments.IsValid = false;                                      
        return false; 
     }
}


// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : GroupBookingDepartureDate()
// Input : Is Terms condition true
// Module : Member/Grpbook1.aspx
// Purpose : calculate Departure Date
function GroupBookingDepartureDate(EBizTxtNoOfNigths, EBizTxtDepartureDate,EbizTxtArrivalDate)
{      
     var TxtNoOfNigths =document.getElementById(EBizTxtNoOfNigths);
     var txtDepartureDate =document.getElementById(EBizTxtDepartureDate);
     var TxtArrivalDate =document.getElementById(EbizTxtArrivalDate);
    
    var strArrivaldate= TxtArrivalDate.value.split('/');
   
     if(TxtArrivalDate.value.length >0)
     {
          var dateArrivaldate=strArrivaldate[1] +'/'+ strArrivaldate[0] +'/'+ strArrivaldate[2];
          var ConveredDate=new Date(dateArrivaldate);
          var NoOfNigths=0;
          var Month=0;
           if(TxtNoOfNigths.value.length >0)
           {
                NoOfNigths=parseFloat(TxtNoOfNigths.value);
           }
           else
           {
                NoOfNigths=0;
           }
           
           if(NoOfNigths >0)
           {
                //NoOfNigths=NoOfNigths-1;
                ConveredDate.setDate(ConveredDate.getDate() + NoOfNigths);
                Month=parseInt(ConveredDate.getMonth()) + 1;
                txtDepartureDate.value=  ConveredDate.getDate()+'/'+Month+'/'+ConveredDate.getFullYear();
           }
           else
           {
              //alert("Please enter number of nigths should be numeric and greater than 0.");
              TxtNoOfNigths.value='';
              txtDepartureDate.value='';
           }
     }
     else
     {
        alert("Please select Arrival Date first.");
        TxtNoOfNigths.value='';
        txtDepartureDate.value='';
     }
}

// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : IsShowDivSharedRoom()
// Input : 
// Module : Member/Grpbook1.aspx
// Purpose : If Shared Beds Required then show DivSharedRoom,else visiable=false
function IsShowDivSharedRoom(pnlSharedRoom)
{  
    var NO=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_1');
    var YES=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_0');
    var pnlSharedRoomDiv=document.getElementById(pnlSharedRoom);
  
    if(NO.checked==true)
    {  
        pnlSharedRoomDiv.style.display = 'none';
    }
    else if(YES.checked==true)
    {  
        pnlSharedRoomDiv.style.display = 'block';
    }
}


// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : IsAnySpecificAreaRequire()
// Input : 
// Module : Member/Grpbook2.aspx
// Purpose : If Choose Other Specific area Option then enable EBizTxtSpecificArea Text Box else Disable
function IsAnySpecificAreaRequire(EBizTxtSpecificArea)
{  
    var Yes=document.getElementById('ctl00_ctn1_rblstAccommodationSelection_6');
    var TxtSpecificArea=document.getElementById(EBizTxtSpecificArea);
  
    if(Yes.checked==true)
    {  
         TxtSpecificArea.disabled=false;
         TxtSpecificArea.style.background="#ffffff";
    }
    else
    {
          TxtSpecificArea.disabled=true;
         TxtSpecificArea.style.background="#cccccc";
    }
}


// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : IsRequireEBizTxtNoOfmale()
// Input : 
// Module : Member/Grpbook1.aspx
// Purpose : If Shared Beds Required then show DivSharedRoom and it should be fource to enter no for male
function IsRequireEBizTxtNoOfmale(source, arguments)
{    
        var TxtNoOfmale='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("EBizTxtNoOfmale")>0)
                { 
                    TxtNoOfmale=trim(elm.value);
                }
            }
         }
         var NO=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_1');
         var YES=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_0');
      
         if(NO.checked)
         { 
            arguments.IsValid = true;
            return true;
         }
        else if(YES.checked)
         {
            if(parseFloat(TxtNoOfmale)>0)
            {
                arguments.IsValid = true;
                return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            } 
         }
}

// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : IsRequireEBizTxtNoOfFemale()
// Input : 
// Module : Member/Grpbook1.aspx
// Purpose : If Shared Beds Required then show DivSharedRoom and it should be fource to enter no for male
function IsRequireEBizTxtNoOfFemale(source, arguments)
{    
        var NoOfFemale='';
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("EBizTxtNoOfFemale")>0)
                { 
                    NoOfFemale=trim(elm.value);
                }
            }
         }
         var NO=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_1');
         var YES=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_0');
      
         if(NO.checked)
         { 
            arguments.IsValid = true;
            return true;
         }
        else if(YES.checked)
         {
            if(parseFloat(NoOfFemale)>0)
            {
                arguments.IsValid = true;
                return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            } 
         }
}

function clickButton(e, buttonid)
{ 
      var evt = e ? e : window.event;
      var bt = document.getElementById(buttonid);
      if (bt != null)
      { 
          if (evt.keyCode == 13)
          { 
                bt.click(); 
                return false; 
          } 
      } 
}


// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : CalculateQuotePrice()
// Input : 
// Module : Super/GroupBookingEnquire.aspx in vViewPropertyRates View
// Purpose : calculate Book room Price
//function CalculateQuotePrice(TxtDormBeds, TxtDormRate,lblDormTotal,TxtDoubleBeds,TxtDoubleRate,lblDoubleTotal,TxtSingleBeds,TxtSingleRate,lblSingleTotal,TxtTwinBeds,TxtTwinRate,lblTwinTotal,TxtMixedBeds,TxtMixedRate,lblMixedTotal,lblSubTotal,NoOfNigths,lblItemBookedRateSubTotal,lblGrandtotal)
//{      
//   
//    var SubTotal =document.getElementById(lblSubTotal);
//    var Grandtotal =document.getElementById(lblGrandtotal);
//    var ItemBookedRateSubTotal =document.getElementById(lblItemBookedRateSubTotal);
//    
//    
//    // Shared Dorm Room
//     var DormBeds =document.getElementById(TxtDormBeds);
//     var DormRate =document.getElementById(TxtDormRate);
//     var DormTotal =document.getElementById(lblDormTotal);
//     
//     var TxtDormBedsLength=trim(DormBeds.value);
//     var TxtDormRateLength=trim(DormRate.value);
//     var intDormBeds=0;
//     var intDormRate=0;
//     if(TxtDormBedsLength.length>0)
//     {
//        if(parseFloat(TxtDormBedsLength)>0)
//        intDormBeds=parseFloat(TxtDormBedsLength);
//     }
//     if(TxtDormRateLength.length>0)
//     {
//         if(parseFloat(TxtDormRateLength)>0)
//        intDormRate=parseFloat(TxtDormRateLength);
//     }
//     var DormBedsTotal=ReturnValue(intDormBeds * intDormRate * NoOfNigths);
//     DormTotal.innerHTML=DormBedsTotal;
// 
//      // Double Room
//      var DoubleBeds =document.getElementById(TxtDoubleBeds);
//     var DoubleRate =document.getElementById(TxtDoubleRate);
//     var DoubleTotal =document.getElementById(lblDoubleTotal);
//    
//     var TxtDoubleBedsLength=trim(DoubleBeds.value);
//     var TxtDoubleRateLength=trim(DoubleRate.value);
//     var intDoubleBeds=0;
//     var intDoubleRate=0;
//     if(TxtDoubleBedsLength.length>0)
//     {
//        if(parseFloat(TxtDoubleBedsLength)>0)
//        intDoubleBeds=parseFloat(TxtDoubleBedsLength);
//     }
//     if(TxtDoubleRateLength.length>0)
//     {
//         if(parseFloat(TxtDoubleRateLength)>0)
//        intDoubleRate=parseFloat(TxtDoubleRateLength);
//     }
//     var DoubleBedsTotal=ReturnValue(intDoubleBeds * intDoubleRate * NoOfNigths);
//     DoubleTotal.innerHTML=DoubleBedsTotal;
//     

//      // Single Room
//     var SingleBeds =document.getElementById(TxtSingleBeds);
//     var SingleRate =document.getElementById(TxtSingleRate);
//     var SingleTotal =document.getElementById(lblSingleTotal);
//    
//     var TxtSingleBedsLength=trim(SingleBeds.value);
//     var TxtSingleRateLength=trim(SingleRate.value);
//     var intSingleBeds=0;
//     var intSingleRate=0;
//     if(TxtSingleBedsLength.length>0)
//     {
//        if(parseFloat(TxtSingleBedsLength)>0)
//        intSingleBeds=parseFloat(TxtSingleBedsLength);
//     }
//     if(TxtSingleRateLength.length>0)
//     {
//         if(parseFloat(TxtSingleRateLength)>0)
//        intSingleRate=parseFloat(TxtSingleRateLength);
//     }
//     var SingleBedsTotal=ReturnValue(intSingleBeds * intSingleRate * NoOfNigths);
//     SingleTotal.innerHTML=SingleBedsTotal;
//     
//     
//       // Twin Room
//     var TwinBeds =document.getElementById(TxtTwinBeds);
//     var TwinRate =document.getElementById(TxtTwinRate);
//     var TwinTotal =document.getElementById(lblTwinTotal);
//  
//     var TxtTwinBedsLength=trim(TwinBeds.value);
//     var TxtTwinRateLength=trim(TwinRate.value);
//     var intTwinBeds=0;
//     var intTwinRate=0;
//     if(TxtTwinBedsLength.length>0)
//     {
//        if(parseFloat(TxtTwinBedsLength)>0)
//        intTwinBeds=parseFloat(TxtTwinBedsLength);
//     }
//     if(TxtTwinRateLength.length>0)
//     {
//         if(parseFloat(TxtTwinRateLength)>0)
//        intTwinRate=parseFloat(TxtTwinRateLength);
//     }
//     var TwinBedsTotal=ReturnValue(intTwinBeds * intTwinRate * NoOfNigths);
//     TwinTotal.innerHTML=TwinBedsTotal;
//     
//     
//     // Mixed Room
//     var MixedBeds =document.getElementById(TxtMixedBeds);
//     var MixedRate =document.getElementById(TxtMixedRate);
//     var MixedTotal =document.getElementById(lblMixedTotal);

//     var TxtMixedBedsLength=trim(MixedBeds.value);
//     var TxtMixedRateLength=trim(MixedRate.value);
//     var intMixedBeds=0;
//     var intMixedRate=0;
//     if(TxtMixedBedsLength.length>0)
//     {
//        if(parseFloat(TxtMixedBedsLength)>0)
//        intMixedBeds=parseFloat(TxtMixedBedsLength);
//     }
//     if(TxtMixedRateLength.length>0)
//     {
//         if(parseFloat(TxtMixedRateLength)>0)
//        intMixedRate=parseFloat(TxtMixedRateLength);
//     }
//     var MixedBedsTotal=ReturnValue(intMixedBeds * intMixedRate * NoOfNigths);
//     MixedTotal.innerHTML=MixedBedsTotal;
//   //  alert(DormBedsTotal + ' ' + DoubleBedsTotal +' ' + SingleBedsTotal  + ' ' + TwinBedsTotal + ' '+MixedBedsTotal)
//   
//     var RoomSubTotal=ReturnValue(parseFloat(DormBedsTotal) + parseFloat(DoubleBedsTotal) + parseFloat(SingleBedsTotal) + parseFloat(TwinBedsTotal) + parseFloat(MixedBedsTotal));
//     SubTotal.innerHTML=RoomSubTotal;
//    Grandtotal.innerHTML=ReturnValue(RoomSubTotal + parseFloat(ItemBookedRateSubTotal.innerHTML));
//     
//}

function CalculateQuotePrice(TxtDormBeds, TxtDormRate,lblDormTotal,TxtDoubleBeds,TxtDoubleRate,lblDoubleTotal,TxtSingleBeds,TxtSingleRate,lblSingleTotal,TxtTwinBeds,TxtTwinRate,lblTwinTotal,lblSubTotal,NoOfNigths,lblItemBookedRateSubTotal,lblGrandtotal,DepostAmount,lblDepostAmount,lblPayNowAmount)
{      
   
    var SubTotal =document.getElementById(lblSubTotal);
    var Grandtotal =document.getElementById(lblGrandtotal);
    var ItemBookedRateSubTotal =document.getElementById(lblItemBookedRateSubTotal);
    
    
    var lblDepostAmountID=document.getElementById(lblDepostAmount);
    var lblPayNowAmountID=document.getElementById(lblPayNowAmount);
    
     // Shared Dorm Room
     var DormBeds =document.getElementById(TxtDormBeds);
     var DormRate =document.getElementById(TxtDormRate);
     var DormTotal =document.getElementById(lblDormTotal);
     
     var TxtDormBedsLength=trim(DormBeds.value);
     var TxtDormRateLength=trim(DormRate.value);
     var intDormBeds=0;
     var intDormRate=0;
     if(TxtDormBedsLength.length>0)
     {
        if(parseFloat(TxtDormBedsLength)>0)
        intDormBeds=parseFloat(TxtDormBedsLength);
     }
     if(TxtDormRateLength.length>0)
     {
         if(parseFloat(TxtDormRateLength)>0)
        intDormRate=parseFloat(TxtDormRateLength);
     }
     var DormBedsTotal=ReturnValue(intDormBeds * intDormRate * NoOfNigths);
     DormTotal.innerHTML=DormBedsTotal;
 
      // Double Room
      var DoubleBeds =document.getElementById(TxtDoubleBeds);
     var DoubleRate =document.getElementById(TxtDoubleRate);
     var DoubleTotal =document.getElementById(lblDoubleTotal);
    
     var TxtDoubleBedsLength=trim(DoubleBeds.value);
     var TxtDoubleRateLength=trim(DoubleRate.value);
     var intDoubleBeds=0;
     var intDoubleRate=0;
     if(TxtDoubleBedsLength.length>0)
     {
        if(parseFloat(TxtDoubleBedsLength)>0)
        intDoubleBeds=parseFloat(TxtDoubleBedsLength);
     }
     if(TxtDoubleRateLength.length>0)
     {
         if(parseFloat(TxtDoubleRateLength)>0)
        intDoubleRate=parseFloat(TxtDoubleRateLength);
     }
     var DoubleBedsTotal=ReturnValue(intDoubleBeds * intDoubleRate * NoOfNigths);
     DoubleTotal.innerHTML=DoubleBedsTotal;
     

      // Single Room
     var SingleBeds =document.getElementById(TxtSingleBeds);
     var SingleRate =document.getElementById(TxtSingleRate);
     var SingleTotal =document.getElementById(lblSingleTotal);
    
     var TxtSingleBedsLength=trim(SingleBeds.value);
     var TxtSingleRateLength=trim(SingleRate.value);
     var intSingleBeds=0;
     var intSingleRate=0;
     if(TxtSingleBedsLength.length>0)
     {
        if(parseFloat(TxtSingleBedsLength)>0)
        intSingleBeds=parseFloat(TxtSingleBedsLength);
     }
     if(TxtSingleRateLength.length>0)
     {
         if(parseFloat(TxtSingleRateLength)>0)
        intSingleRate=parseFloat(TxtSingleRateLength);
     }
     var SingleBedsTotal=ReturnValue(intSingleBeds * intSingleRate * NoOfNigths);
     SingleTotal.innerHTML=SingleBedsTotal;
     
     
       // Twin Room
     var TwinBeds =document.getElementById(TxtTwinBeds);
     var TwinRate =document.getElementById(TxtTwinRate);
     var TwinTotal =document.getElementById(lblTwinTotal);
  
     var TxtTwinBedsLength=trim(TwinBeds.value);
     var TxtTwinRateLength=trim(TwinRate.value);
     var intTwinBeds=0;
     var intTwinRate=0;
     if(TxtTwinBedsLength.length>0)
     {
        if(parseFloat(TxtTwinBedsLength)>0)
        intTwinBeds=parseFloat(TxtTwinBedsLength);
     }
     if(TxtTwinRateLength.length>0)
     {
         if(parseFloat(TxtTwinRateLength)>0)
        intTwinRate=parseFloat(TxtTwinRateLength);
     }
     var TwinBedsTotal=ReturnValue(intTwinBeds * intTwinRate * NoOfNigths);
     TwinTotal.innerHTML=TwinBedsTotal;
     
     var RoomSubTotal=ReturnValue(parseFloat(DormBedsTotal) + parseFloat(DoubleBedsTotal) + parseFloat(SingleBedsTotal) + parseFloat(TwinBedsTotal));
     SubTotal.innerHTML=RoomSubTotal;
     Grandtotal.innerHTML=ReturnValue(RoomSubTotal + parseFloat(ItemBookedRateSubTotal.innerHTML));
     
     var GrndTotal=0;
     var TotalDepositAmount=0;
     GrndTotal=ReturnValue(RoomSubTotal + parseFloat(ItemBookedRateSubTotal.innerHTML));
     TotalDepositAmount =GrndTotal/DepostAmount;
     lblDepostAmountID.innerHTML=ReturnValue(TotalDepositAmount);
     lblPayNowAmountID.innerHTML=ReturnValue(GrndTotal-TotalDepositAmount);
}



// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : CalculateItemBookedPrice()
// Input : 
// Module : Super/GroupBookingEnquire.aspx in vViewPropertyRates View
// Purpose : calculate Item Booked Price

function CalculateItemBookedPrice(hfItemExtrasQuantity,hfItemExtrasPrice,hfItemExtrasTotal,
PropertyMarkup,PropertyBaseRate,lblItemTotal,BaseCurrSign,PropertyCurrSign,hfDepositAmount,
GrandTotal,lblTotalDeposit,hfIsPayDeposit,hfItemAmountPayNow,ItemPercentDeposit,
lblItemGrandTotal,lblBalanceQuote,lblGrandTotal,TotalRoomAmount)
{     
  
    // Balance Due
    var lblBalance=document.getElementById(lblBalanceQuote);
    // Total Of Item and Rooms Price
    var lblGrand=document.getElementById(lblGrandTotal);
    // PayNow 
    var ItemAmountPayNowID=document.getElementById(hfItemAmountPayNow);
    var ItemAmountPayNow=ItemAmountPayNowID.value.split('#') ;  
     
    // IsPay Deposit
    var hfIsPayDepositID=document.getElementById(hfIsPayDeposit);
    var PayDepositID=hfIsPayDepositID.value.split('#') ;  
    
    // Item Total
    var ItemTotal=document.getElementById(lblItemTotal);
    var TotalDeposit=document.getElementById(lblTotalDeposit);
    // Get Total Room Deposit Amount
    var TotalDepositAmt=document.getElementById(hfDepositAmount);
    
    // Grand Total of Items
    var lblItemTotalID=document.getElementById(lblItemGrandTotal);
    
    var NumberOfRecord=0;
    // Get ItemExtras QuantityID
    var ItemExtrasQuantityID=document.getElementById(hfItemExtrasQuantity);
    var ItemExtrasQuantity = ItemExtrasQuantityID.value.split('#') ; 

    // Get ItemExtras Price
    var ItemExtrasPriceID=document.getElementById(hfItemExtrasPrice);
    var ItemExtrasPrice = ItemExtrasPriceID.value.split('#') ; 

     // Get ItemExtras Total
    var ItemExtrasTotalID=document.getElementById(hfItemExtrasTotal);
    var ItemExtrasTotal = ItemExtrasTotalID.value.split('#') ;

    NumberOfRecord=ItemExtrasQuantity.length;
    var Quantity=0;
    var TotalPrice=0;
    var SubTotal=0
    var ItemGrandTotal=0; 
    var TotalItemPayNow=0;      
    for( var i = 1 ; i < NumberOfRecord ; i++ )
      {
       if ( NumberOfRecord == 0 )
            continue ;
            var TxtPriceLength=_slsTrim(document.getElementById(ItemExtrasPrice[i]).value);
            TxtPriceLength=TxtPriceLength.replace(',','');
            if(TxtPriceLength.length >0)
            {
              if(parseFloat(TxtPriceLength)>0)
              Price=parseFloat(TxtPriceLength);
              else
              Price=0;
            }
            
            Quantity=parseFloat(document.getElementById(ItemExtrasQuantity[i]).innerHTML);
            TotalPrice=ReturnValue(Quantity * Price);
            
            ItemGrandTotal=ItemGrandTotal + TotalPrice;
            var PayNow=0;
            
            if(PayDepositID[i]=='True') // Get Only Defined Percent Of Amount
             {
                PayNow=(ItemPercentDeposit / 100) * TotalPrice;
             }
             else
             {
                PayNow=TotalPrice;
             }
             TotalItemPayNow=TotalItemPayNow + PayNow;
             //alert(document.getElementById(ItemExtrasTotal[i]).innerHTML);
            document.getElementById(ItemExtrasTotal[i]).innerHTML=RoundNumber(TotalPrice);//.toFixed(2);
            
            document.getElementById(ItemAmountPayNow[i]).innerHTML=RoundNumber(PayNow);//.toFixed(2);
       }         
  var TotalPriceProperty= RoundNumber(BaseCurrencyToSelectedCurrency(TotalItemPayNow,PropertyBaseRate,PropertyMarkup))

  var Deposit=parseFloat(TotalDepositAmt.value) + parseFloat(TotalPriceProperty);
  ItemGrandTotal=RoundNumber(BaseCurrencyToSelectedCurrency(ItemGrandTotal,PropertyBaseRate,PropertyMarkup))
  lblItemTotalID.innerHTML='<b>' + PropertyCurrSign + '</b>' + ItemGrandTotal;
  
  // Total Deposit
  TotalDeposit.innerHTML='<b>' + PropertyCurrSign + '</b>' + RoundNumber(Deposit);
  //alert(SubTotal);
  ItemTotal.innerHTML='<b>' + PropertyCurrSign + '</b>' + TotalPriceProperty + '(<b>'+BaseCurrSign + '</b>' + RoundNumber(TotalItemPayNow) +')';

  // Item and Room Price Total
  var TotalAmt=parseFloat(TotalRoomAmount) + parseFloat(ItemGrandTotal);
  lblGrand.innerHTML='<b>' + PropertyCurrSign + '</b>' + RoundNumber(TotalAmt);
  
  // Balance Due Amount
  var BalanceDue= parseFloat(TotalAmt) - parseFloat(Deposit);
  lblBalance.innerHTML='<b>' + PropertyCurrSign + '</b>' + RoundNumber(BalanceDue)  ;
//alert('Amt= ' + TotalAmt + '   ' + 'Dep= ' + Deposit + '  BalanceDue= ' + BalanceDue);
             
}

function CopyAllPrice(hfItemPrice1,hfItemPrice2,hfItemPrice3,hfItemPrice4,
hftotalprice1,hftotalprice2,hftotalprice3,hftotalprice4,hftotalpriceofallroom,NoOfSharedRoom,
NoOfSingleRoom,NoOfDoubleRoom,NoOfTwinRoom,lblgrandprice)
{
     var NumberOfRecord=0;
     var hfItemPricefirst    = document.getElementById(hfItemPrice1);
     var hfItemPricesecond   = document.getElementById(hfItemPrice2);
     var hfItemPricethird    = document.getElementById(hfItemPrice3);
     var hfItemPricefourth   = document.getElementById(hfItemPrice4);    
     
     var SharedRoom = hfItemPricefirst.value.split('#'); 
     var SingleRoom = hfItemPricesecond.value.split('#'); 
     var DoubleRoom = hfItemPricethird.value.split('#'); 
     var TwinRoom = hfItemPricefourth.value.split('#'); 
     
     NumberOfRecord=SharedRoom.length;
  
  
    // Copy All Price From First Row To Other Rows 
      for( var irow = 1 ; irow < NumberOfRecord ; irow++ )
          {
           if ( NumberOfRecord == 0 )
                continue ;   
               var Shared=trim(document.getElementById(SharedRoom[1]).value);
               var Single=trim(document.getElementById(SingleRoom[1]).value);
               var Double=trim(document.getElementById(DoubleRoom[1]).value);
               var Twin=trim(document.getElementById(TwinRoom[1]).value);
               if(irow !=1)
               {  
                document.getElementById(SharedRoom[irow]).value=Shared;
                document.getElementById(SingleRoom[irow]).value=Single;
                document.getElementById(DoubleRoom[irow]).value=Double;
                document.getElementById(TwinRoom[irow]).value=Twin;
               }
          }
          
   
    var lblgrandpricegrid = document.getElementById(lblgrandprice);            
          
    var hftotalpricefirst = document.getElementById(hftotalprice1);
    var hftotalpricesecond = document.getElementById(hftotalprice2);
    var hftotalpricethird = document.getElementById(hftotalprice3);
    var hftotalpricefourth = document.getElementById(hftotalprice4);
    
      // Array for Price
    var RoomTotal_P1 = hftotalpricefirst.value.split('#') ; 
    var RoomTotal_P2 = hftotalpricesecond.value.split('#') ; 
    var RoomTotal_P3 = hftotalpricethird.value.split('#') ; 
    var RoomTotal_P4 = hftotalpricefourth.value.split('#') ; 
    
    var hftotalpricemain = document.getElementById(hftotalpriceofallroom);
    // Array for Price
    var RoomTotal = hftotalpricemain.value.split('#') ;
    
    var P1_Total=0;
    var P2_Total=0;
    var P3_Total=0;
    var P4_Total=0;
    var grandtotal = 0;
    
     for( var i = 1 ; i < NumberOfRecord ; i++ )
        {
               if ( NumberOfRecord == 0 )
                    continue ;  
                    
               var Price1=trim(document.getElementById(SharedRoom[i]).value);
               var Price2=trim(document.getElementById(SingleRoom[i]).value);
               var Price3=trim(document.getElementById(DoubleRoom[i]).value);
               var Price4=trim(document.getElementById(TwinRoom[i]).value);                   
              
               var T1=Price1 * NoOfSharedRoom;                   
               var T2=Price2 * NoOfSingleRoom;
               var T3=Price3 * NoOfDoubleRoom;
               var T4=Price4 * NoOfTwinRoom;
               
              
               document.getElementById(RoomTotal_P1[i]).innerHTML=T1.toFixed(2);
               document.getElementById(RoomTotal_P2[i]).innerHTML=T2.toFixed(2);
               document.getElementById(RoomTotal_P3[i]).innerHTML=T3.toFixed(2);
               document.getElementById(RoomTotal_P4[i]).innerHTML=T4.toFixed(2);
               var Total=T1+T2+T3+T4;
               document.getElementById(RoomTotal[i]).innerHTML=Total.toFixed(2);      
         }
      
      var grandtotalsecond = 0;
      var grandtotal = 0;      
          for(var j = 1 ; j < NumberOfRecord ; j++ )
          {              
                    
                 var grandtotal = document.getElementById(RoomTotal[j]).innerHTML;           
                 grandtotalsecond = grandtotalsecond + parseFloat(grandtotal);
                 
          }
      
      var gtotal = grandtotalsecond.toFixed(2);
      var GrandTotal = document.getElementById('ctl00_ctn1_gvBookingDetail_ctl02_lblGrandTotal');
              
      if(GrandTotal !=null)
       {
         GrandTotal.innerHTML = gtotal;
       }
        
}


function CalculatetotalPrice(hfItemPrice1,hfItemPrice2,hfItemPrice3,hfItemPrice4,hftotalprice1,hftotalprice2,hftotalprice3,hftotalprice4,hftotalpriceofallroom,lblBookingCount1,lblBookingCount2,lblBookingCount3,lblBookingCount4,lblgrandprice)
{
    var NumberOfRecord=0;

     
    var hfItemPricefirst    = document.getElementById(hfItemPrice1);
    var hfItemPricesecond   = document.getElementById(hfItemPrice2);
    var hfItemPricethird    = document.getElementById(hfItemPrice3);
    var hfItemPricefourth   = document.getElementById(hfItemPrice4);    
    
     // Array for Price
    var P1 = hfItemPricefirst.value.split('#'); 
    var P2 = hfItemPricesecond.value.split('#'); 
    var P3 = hfItemPricethird.value.split('#'); 
    var P4 = hfItemPricefourth.value.split('#'); 
    
    NumberOfRecord=P1.length;
     
    var lblBookingCountfirst    = document.getElementById(lblBookingCount1);
    var lblBookingCountsecond   = document.getElementById(lblBookingCount2);
    var lblBookingCountthird    = document.getElementById(lblBookingCount3);
    var lblBookingCountfourth   = document.getElementById(lblBookingCount4);    

     var lblgrandpricegrid = document.getElementById(lblgrandprice);            
             
    var hftotalpricefirst = document.getElementById(hftotalprice1);
    var hftotalpricesecond = document.getElementById(hftotalprice2);
    var hftotalpricethird = document.getElementById(hftotalprice3);
    var hftotalpricefourth = document.getElementById(hftotalprice4);
    
      // Array for Price
    var RoomTotal_P1 = hftotalpricefirst.value.split('#') ; 
    var RoomTotal_P2 = hftotalpricesecond.value.split('#') ; 
    var RoomTotal_P3 = hftotalpricethird.value.split('#') ; 
    var RoomTotal_P4 = hftotalpricefourth.value.split('#') ; 
    
    var hftotalpricemain = document.getElementById(hftotalpriceofallroom);
              // Array for Price
   var RoomTotal = hftotalpricemain.value.split('#') ;
   
    
    var P1_Total=0;
    var P2_Total=0;
    var P3_Total=0;
    var P4_Total=0;
    var grandtotal = 0;
    
     for( var i = 1 ; i < NumberOfRecord ; i++ )
              {
               if ( NumberOfRecord == 0 )
                    continue ;                   
                   
                   var Price1=trim(document.getElementById(P1[i]).value);
                   var Price2=trim(document.getElementById(P2[i]).value);
                   var Price3=trim(document.getElementById(P3[i]).value);
                   var Price4=trim(document.getElementById(P4[i]).value);                   
                  
                    var T1=Price1 * lblBookingCountfirst.innerHTML;                   
                    var T2=Price2 * lblBookingCountsecond.innerHTML;
                    var T3=Price3 * lblBookingCountthird.innerHTML;
                    var T4=Price4 * lblBookingCountfourth.innerHTML;
                   
                  
                    document.getElementById(RoomTotal_P1[i]).innerHTML=T1.toFixed(2);
                    document.getElementById(RoomTotal_P2[i]).innerHTML=T2.toFixed(2);
                    document.getElementById(RoomTotal_P3[i]).innerHTML=T3.toFixed(2);
                    document.getElementById(RoomTotal_P4[i]).innerHTML=T4.toFixed(2);
                    var Total=T1+T2+T3+T4;
                    document.getElementById(RoomTotal[i]).innerHTML=Total.toFixed(2);      
                             
              }
               var grandtotalsecond = 0;
              var grandtotal = 0;      
              for(var j = 1 ; j < NumberOfRecord ; j++ )
              {              
                        
                     var grandtotal = document.getElementById(RoomTotal[j]).innerHTML;           
                     grandtotalsecond = grandtotalsecond + parseFloat(grandtotal);
                     
              }
              var gtotal = grandtotalsecond.toFixed(2);
              
            
              var GrandTotal = document.getElementById('ctl00_ctn1_gvBookingDetail_ctl02_lblGrandTotal');
              
              if(GrandTotal !=null)
              {
                GrandTotal.innerHTML = gtotal;
              }
            if(lblgrandpricegrid !=null)
            {
              lblgrandpricegrid.innerHTML = gtotal;
            }
 }

// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : CheckBookingDate()
// Input : 
// Module : Control/UserSearch.ascx
// Purpose : Date Compare with Current Date

function CheckBookingDate(source, arguments)
{      
        var strDateFrom='';
        var strDateTo='';
        
        var ddlMonth =document.getElementById('ctl00_ucSearch_ddlMonth');
        var ddlDay =document.getElementById('ctl00_ucSearch_ddlDay');
        var ddlYear =document.getElementById('ctl00_ucSearch_ddlYear');
        
        var strDateTo= ddlDay.value+'/'+ ddlMonth.value +'/'+ ddlYear.value;
    
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
            if(elm.name.indexOf("hfCurrentBookingDate")>0)
                { 
                    strDateFrom=elm.value;  
                }
         }
	var FromDate = strDateFrom.split('/');
	var FirstYear 	 = parseFloat(FromDate[2]);
	var FirstMonth	 = parseFloat(FromDate[1]);
	var FirstDate	 = parseFloat(FromDate[0]);

	//alert(strDateTo + ' ' + strDateFrom);
	
	var ToDate = strDateTo.split('/');
	var SecondYear 	 = parseFloat(ToDate[2]);
	var SecondMonth	 = parseFloat(ToDate[1]);
	var SecondDate	 = parseFloat(ToDate[0]);

      if (SecondYear >= FirstYear)
      {
        if(SecondMonth >= FirstMonth)
        {
           // alert('Month =True= ' + SecondMonth + '>=' + FirstMonth)
            if(SecondMonth == 2)
            {
                if(SecondDate >28)
                {
                     arguments.IsValid = false;
                    return false;
                }
                else
                {
                    if(SecondDate >= FirstDate)
                    {
                         arguments.IsValid = true;
                        return true;
                    }
                    else
                    {
                        arguments.IsValid = false;
                        return false;
                    }
                }
            }
            else if(SecondDate >= FirstDate)
            {
                //alert('Date =True= ' + SecondDate + '>=' + FirstDate)
                arguments.IsValid = true;
                return true;
            }
            else
            {
                //alert('Date =False= ' + SecondDate + '<' + FirstDate)
                arguments.IsValid = false;
                return false;
            }
        }
         else
            {
               // alert('Month =False= ' + SecondMonth + '<' + FirstMonth)
                arguments.IsValid = false;
                return false;
            }
      }
   else
        {
            //alert('Year =False= ' + SecondYear + '<' + FirstYear)
            arguments.IsValid = false;
            return false;
        }
}

function CheckBookingDateHostelSearch(source, arguments)
{      
        var strDateFrom='';
        var strDateTo='';
        var DateTo='';
         for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("hfCurrentBookingDate")>0)
                { 
                    strDateFrom=elm.value;  
                }
            if(elm.name.indexOf("TxtSelectedValue")>0)
                { 
                    DateTo=elm.value;
                    
                    var strDate = DateTo.split('#');
       
	                var Year 	 = parseFloat(document.getElementById(strDate[2]).value);
	                var Month	 = parseFloat(document.getElementById(strDate[1]).value);
	                var Date	 = parseFloat(document.getElementById(strDate[0]).value);
	                strDateTo=Date+'/'+ Month +'/'+ Year;
	                
                }
         }
         
         
	var FromDate = strDateFrom.split('/');
	var FirstYear 	 = parseFloat(FromDate[2]);
	var FirstMonth	 = parseFloat(FromDate[1]);
	var FirstDate	 = parseFloat(FromDate[0]);

	
	var ToDate = strDateTo.split('/');
	var SecondYear 	 = parseFloat(ToDate[2]);
	var SecondMonth	 = parseFloat(ToDate[1]);
	var SecondDate	 = parseFloat(ToDate[0]);
      
    if(SecondYear > FirstYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(SecondYear < FirstYear)
    {
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(SecondMonth > FirstMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }
	 	else if(SecondMonth < FirstMonth)
	    {
		    arguments.IsValid = false;
		    return false;
	    }	
	    else
	    {
		    if(SecondDate >= FirstDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else     
		    {   
		        arguments.IsValid = false;
                return false;
		    }    		
	    }
    }      
}



// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : CheckBookingDateSearch()
// Input : 
// Module : Control/Search.ascx
// Purpose : Date Compare with Current Date
function CheckBookingDateSearch(source, arguments)
{      
        var strDateFrom='';
        var strDateTo='';
       
        var ddlMonth =document.getElementById('ctl00_ctn1_LeftControl1_cntSearch_ddlMonth');
        var ddlDay =document.getElementById('ctl00_ctn1_LeftControl1_cntSearch_ddlDate');
        var ddlYear =document.getElementById('ctl00_ctn1_LeftControl1_cntSearch_ddlYear');
       
        
        
        var strDateTo= ddlDay.value+'/'+ ddlMonth.value +'/'+ ddlYear.value;
        
         for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("hfCurrentBookingDate")>0)
                { 
                    strDateFrom=elm.value;  
                }
         }
	var FromDate = strDateFrom.split('/');
	var FirstYear 	 = parseFloat(FromDate[2]);
	var FirstMonth	 = parseFloat(FromDate[1]);
	var FirstDate	 = parseFloat(FromDate[0]);

	//alert(strDateTo + ' ' + strDateFrom);
	
	var ToDate = strDateTo.split('/');
	var SecondYear 	 = parseFloat(ToDate[2]);
	var SecondMonth	 = parseFloat(ToDate[1]);
	var SecondDate	 = parseFloat(ToDate[0]);
      
    if(SecondYear > FirstYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(SecondYear < FirstYear)
    {
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(SecondMonth > FirstMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }
	 	else if(SecondMonth < FirstMonth)
	    {
		    arguments.IsValid = false;
		    return false;
	    }	
	    else
	    {
		    if(SecondDate >= FirstDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else     
		    {   
		        arguments.IsValid = false;
                return false;
		    }    		
	    }
    }      
}



function CheckBookingDateUserSearch(source, arguments)
{      
        var strDateFrom='';
        var strDateTo='';
       
        var ddlMonth =document.getElementById('ctl00_ucSearch_ddlMonth');
        var ddlDay =document.getElementById('ctl00_ucSearch_ddlDay');
        var ddlYear =document.getElementById('ctl00_ucSearch_ddlYear');
        
        var strDateTo= ddlDay.value+'/'+ ddlMonth.value +'/'+ ddlYear.value;
        
         for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("hfCurrentBookingDate")>0)
                { 
                    strDateFrom=elm.value;  
                }
         }
	var FromDate = strDateFrom.split('/');
	var FirstYear 	 = parseFloat(FromDate[2]);
	var FirstMonth	 = parseFloat(FromDate[1]);
	var FirstDate	 = parseFloat(FromDate[0]);

	//alert(strDateTo + ' ' + strDateFrom);
	
	var ToDate = strDateTo.split('/');
	var SecondYear 	 = parseFloat(ToDate[2]);
	var SecondMonth	 = parseFloat(ToDate[1]);
	var SecondDate	 = parseFloat(ToDate[0]);
      
    if(SecondYear > FirstYear)
    {
        arguments.IsValid = true;
        return true;
    }
    else if(SecondYear < FirstYear)
    {
        arguments.IsValid = false;
        return false;
    }
    else
    {
	    if(SecondMonth > FirstMonth)
	    {
		   arguments.IsValid = true;
           return true;
	    }
	 	else if(SecondMonth < FirstMonth)
	    {
		    arguments.IsValid = false;
		    return false;
	    }	
	    else
	    {
		    if(SecondDate >= FirstDate)
		    { 
		        arguments.IsValid = true;
                return true;
		    }
		    else     
		    {   
		        arguments.IsValid = false;
                return false;
		    }    		
	    }
    }      
}


function CheckArrivalDate(source, arguments)
{
   
    var CurrentDate=''
    var SelectedDate=''
    for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("hfCurrentDate")>0)
                { 
                    CurrentDate=elm.value;  
                }
         }
         
          for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("EbizTxtArrivalDate")>0)
                { 
                    SelectedDate=elm.value;  
                }
         }
    if(_slsTrim(SelectedDate) !='')   
    {   
        if(checkdate(SelectedDate)==true)
        {
            if (true==CheckMoreThanEqualToCurrentDate(SelectedDate,CurrentDate) )
            {
                 arguments.IsValid = true;
                 return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
         }
         else
         {
            arguments.IsValid = false;
            return false;
         }
    }
    else
    {
        arguments.IsValid = true;
        return true;
    }
}

//function check_form(datefield)
//{
//   // Regular expression used to check if date is in correct format
//   var pattern = new RegExp((0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d);
//   if(document.getElementById(datefield).value.match(pattern))
//   {
//      var date_array = document.getElementById(datefield)
//                       .value.split('/');
//      var day = date_array[0];

//      // Attention! Javascript consider months in the range 0 - 11
//      var month = date_array[1] - 1;
//      var year = date_array[2];

//      // This instruction will create a date object
//      source_date = new Date(year,month,day);

//      if(year != source_date.getFullYear())
//      {
//         alert('Year is not valid!');
//         return false;
//      }

//      if(month != source_date.getMonth())
//      {
//         alert('Month is not valid!');
//         return false;
//      }

//      if(day != source_date.getDate())
//      {
//         alert('Day is not valid!');
//         return false;
//      }
//   }
//   else
//   {
//      alert('Date format is not valid!');
//      return false;
//   }

//   return true;
//}




function CheckMoreThanEqualToCurrentDate(SelectedDate,CurrentDate)
{
    var IsTrue=false;
    var FromDate = CurrentDate.split('/');
	var FirstYear 	 = parseFloat(FromDate[2]);
	var FirstMonth	 = parseFloat(FromDate[1]);
	var FirstDate	 = parseFloat(FromDate[0]);
	
	var ToDate = SelectedDate.split('/');
	var SecondYear 	 = parseFloat(ToDate[2]);
	var SecondMonth	 = parseFloat(ToDate[1]);
	var SecondDate	 = parseFloat(ToDate[0]);
      
    if(SecondYear > FirstYear)
    {
        IsTrue = true;
    }
    else if(SecondYear < FirstYear)
    {
        IsTrue = false;
    }
    else
    {
	    if(SecondMonth > FirstMonth)
	    {
		   IsTrue = true;
	    }
	 	else if(SecondMonth < FirstMonth)
	    {
		   IsTrue = false;
	    }	
	    else
	    {
		    if(SecondDate >= FirstDate)
		    { 
                IsTrue= true;
		    }
		    else     
		    {   
		        IsTrue = false;
		    }    		
	    }
    } 
    
    return  IsTrue;   
}

// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : AlertMessageForNoCheckOutDate()
// Input : 
// Module : Member/BookingSearch.aspx
// Purpose : To show alert if User select incurrect checkout date
function AlertMessageForNoCheckOutDate(NoCheckOutDate)
{
    alert(NoCheckOutDate + ' is NO-CHECKOUT-DATE for our hostel, please select another date');
    return false;    
}


// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : ClearFieldDataSuperAdmin()
// Input : 
// Module : Super/GroupBooking.aspx
// Purpose : 
function ClearFieldDataSuperAdmin(EBizTxtNoOfNigths,EBizTxtDepartureDate)
{
       var TxtNoOfNigths =document.getElementById(EBizTxtNoOfNigths);
       var TxtDepartureDate =document.getElementById(EBizTxtDepartureDate);
      TxtNoOfNigths.value='';
      TxtDepartureDate.value='';
}


// AJAX
function GetCity(strURL,strCtrlCountryID,strCtrlCityID)
{
    var valCountryID=document.getElementById(strCtrlCountryID).value
    
    GetResults(strURL,valCountryID,strCtrlCityID);
}


function GetState(strURL,strCtrlCountryID,strCtrlStateID,strCtrlCityID)
{
    var valCountryID=document.getElementById(strCtrlCountryID).value
    var ddlcity =  document.getElementById(strCtrlCityID);
     ddlcity.options.length = 0;
     
     var optn = document.createElement("OPTION");
        optn.text = '-Select City-';
        optn.value = 0;
        ddlcity.options.add(optn);
     
     
    GetResults(strURL,valCountryID,strCtrlStateID);
}


function getHTTPObject()
{
	var xmlhttp = false;
	try
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
		try
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlhttp = new XMLHttpRequest();
			}
			catch (e) 
			{ 
				alert(e); 
			}
		}
	}
	return xmlhttp;
}

var a = null; //holds the unprocessed response string
var http = getHTTPObject(); //instantiate the object

//function to process the request
function doRequest(url)
{
   
	if (http)
	{
		try
		{		        
			http.open("GET",url,false);
			http.send(null);
		
			if (http.readyState == 4)
			{			      
				a = http.responseText;
			}
		}
		catch (e) 
		{ 
			alert(e); 
		}
	}
}

// JScript File
function GetResults(strURL,strCountryID,strCtrlCityID)
{
    var valUrl=strURL+"?CountryID="+strCountryID+"&tranID=" + GetRandomNumber();
    doRequest(valUrl);
	FillCity(strCtrlCityID,a,'^');
}


function GetDestCity(strURL,strCtrlStateID,strCtrlCityID,strCtrlCountryID)
{
    var valStateID=document.getElementById(strCtrlStateID).value;
     var valCountryID =  document.getElementById(strCtrlCountryID).value;    
    GetResultsDest(strURL,valStateID,strCtrlCityID,valCountryID);
}


function GetResultsDest(strURL,strStateID,strCtrlCityID,strCountryID)
{
    var valUrl=strURL+"?CountryID="+strCountryID+"&tranID=" + GetRandomNumber()+"&StateID=" + strStateID;
    /*alert(strStateID); */
    doRequest(valUrl);
	FillCity(strCtrlCityID,a,'^');
}





function GetRandomNumber()
{
    var n = 10000;
    return (Math.floor(Math.random()*n));
}

function FillCity(strCtrlCityID,values,delimiter)
{
	if (values)
	{

		var a = new Array();
		ddlCity = null;
		
		a = values.split(delimiter);

		ddlCity = document.getElementById(strCtrlCityID);
        var oIndex=0;
        for(oIndex=0;oIndex < (ddlCity.options.length);)
        {
            ddlCity.remove(oIndex);
        }

        var oCount;
        oIndex=0;
        for(oCount=0; oCount< (a.length-1); ++oCount)
        {
            var oOptionData = a[oCount].split("~");
            ddlCity.options[oIndex]= new Option(oOptionData[0],oOptionData[1]);
            oIndex++;
        }
	}
}

//END AJAX
// Created By : Ashish Srivastava
// Created Date : 17-08-2007
// Function : AlertMessageForNoCheckOutDate()
// Input : 
// Module : Member/BookingSearch.aspx
// Purpose : To show alert if User select incurrect checkout date
function AlertMessageForLogin(txt,login)
{
    var islogin = parseInt(login);
    var tot = 0;
    var txtTot = document.getElementById(txt);
    if (txtTot != null)
    {
        tot = parseInt(txtTot.value);
    }
    if (islogin == 0)
    {
        alert('Please login to perform the action.');
        return false;    
    }
    else if (islogin > 0)
    {
        if (tot == 0)
        {
            alert('Cart cannot be empty.');
            return false; 
        }
        else
        {
            return true;
        }
    }
}


// Created By : Ashish Srivastava
// Created Date : 17-08-2007
// Function : AlertMessageForNoCheckOutDate()
// Input : 
// Module : Member/BookingSearch.aspx
// Purpose : To show alert if User select incurrect checkout date
function AlertMessageForOutOfStock()
{
    alert('Item is not available in the stock, so cannot be added to your cart.');
    return false;    
}


// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : AdvanceSearchSerachControl()
// Input : 
// Module : Control/Search.asax
// Purpose : To Display Advance Search Panel

 function AdvanceSearchSerachControl(AnchrAdvanceSerach,pnlAdvanceSearch,HFAdvanceSearch)
{ 
    var HFAdvanceSearchID= document.getElementById(HFAdvanceSearch);
    
    var AnchrAdvanceSerachID= document.getElementById(AnchrAdvanceSerach);
    var AnchrAdvanceSerachText = AnchrAdvanceSerachID.firstChild.data;   
    //var divImage=document.getElementById('ctl00_ctn1_LeftControl1_divImage');
    var divAllControlID=document.getElementById('divAllControls');
    var pnlAdvanceSearchID = document.getElementById(pnlAdvanceSearch);
    var pagediv=document.getElementById("innerpage-div");
    var Height=pagediv.offsetHeight;  
 
      if(AnchrAdvanceSerachText == 'Advanced Search') 
        {            
            AnchrAdvanceSerachID.firstChild.data = 'Standard Search'; 
            HFAdvanceSearchID.value="1";                        
            if(navigator.appName == "Microsoft Internet Explorer")
                {
                    pnlAdvanceSearchID.style.display = 'block'; 
                    //pagediv.style.height = ( Height + 250)+"px";  
                }
           
                
                //Hide Other Control When Advance Search Show
               
               if(divAllControlID !=null)
               {
                divAllControlID.style.display = 'none';
               }
               
        }
      if(AnchrAdvanceSerachText == 'Standard Search')
       {    
            HFAdvanceSearchID.value="0";                        
            AnchrAdvanceSerachID.firstChild.data = 'Advanced Search';
             if(navigator.appName == "Microsoft Internet Explorer")
                {
                   pnlAdvanceSearchID.style.display = 'none';
                    //pagediv.style.height = ( Height - 250)+"px"; 
                }
               if(divAllControlID !=null)
               {
                divAllControlID.style.display = 'block';
               }                 
       }
       PageHeight_Common();       
}



// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : Facilities()
// Input : 
// Module : Control/Search.asax
// Purpose : To Display Advance Search Panel

 function FacilitySerachControl(pnlFacilitiesTop,pnlFacilitiesAll,HFFacility,value)
{ 

    var pnlFacilitiesTopID = document.getElementById(pnlFacilitiesTop);
    var pnlFacilitiesAllID = document.getElementById(pnlFacilitiesAll);
    var HFFacilityID= document.getElementById(HFFacility);
   
      if(value=="0") 
        {  
            pnlFacilitiesTopID.style.display = 'block';  
            pnlFacilitiesAllID.style.display = 'none'; 
            HFFacilityID.value=1;
        }
      else if(value=="1") 
       { 
            pnlFacilitiesTopID.style.display = 'none';
            pnlFacilitiesAllID.style.display = 'block';              
            HFFacilityID.value=0;
       }
       return false;
}

// Created By : Girish Sharma
// Created Date : 12-11-2007
// Function : GroupBookingShowProductInput()
// Input : 
// Module : Member/GrpBook3.aspx
// Purpose : To Display Group Booking Product Input TextBox 
function GroupBookingShowProductInput(DivProductInput,chkOptionExtras)
{ 

    //var DivMessageID = document.getElementById(DivMessage);
    var DivProductInputID = document.getElementById(DivProductInput);
    var OptionExtras = document.getElementById(chkOptionExtras);
    if(OptionExtras.checked)
    {
        DivProductInputID.style.display = 'block'; 
        //DivMessageID.style.display = 'block'; 
    }
    else
    {
        DivProductInputID.style.display = 'none'; 
        //DivMessageID.style.display = 'none'; 
    }
   
}

// Created By : Preeti jain
// Created Date : 14-11-2007
// Function : BookingGenderMessage()
// Input : 
// Module : Member/Booking.aspx
// Purpose : To Check whether the person who is booking is male or female and that person is booking which room
function BookingGenderMessage(genderMsg,ctrlGender,selectedGenders)
{ 
    var show = 0;
    if (selectedGenders.length>0)
    {
        var genders = selectedGenders.split(',');
        var gndid=0;
        var selectedgendid=0;
        var ctl = document.getElementById(ctrlGender);
        selectedgendid = parseInt(ctl.value);
        for (var i=0;i<genders.length;i++)
        {
            if (parseInt(genders[i]) > 0)
            {
                gndid = parseInt(genders[i]);     
                if (parseInt(gndid) != parseInt(selectedgendid))
                {
                    show = 1;
                    break;
                }
            }
        }
        if (show == 1)
        {
            var msg;
            if (selectedgendid == 1)
                msg = " and you have selected 'Male' as your gender. Click 'OK' to continue, else click 'Cancel' to change.";
            else if (selectedgendid == 2)
                msg = " and you have selected 'Female' as your gender. Click 'OK' to continue, else click 'Cancel' to change."
                
            msg = genderMsg + msg;
            var IsTrue=window.confirm(msg);
            if (IsTrue)
            {  
                return true;
            }   
            else
            {
                return false;
            }  
        } 
    }
    else
    {
        return true;
    }
}

function PrintMe()
{
    document.getElementById("DivButtos").style.visibility="hidden";
    print();
    //document.getElementById("DivButtos").style.visibility="visible";
    window.close();
}


// Created By : Girish Sharma
// Created Date : 16-11-2007
// Function : IsArrivalTimeSelect()
// Input : 
// Module : Member/Booking.aspx
// Purpose : To Check whether Arrival Time Is Selected or Not

function IsArrivalTimeSelect(source, arguments)
{
    var ReturnValue=false;
    var ddlHour=document.getElementById('ctl00_ctn1_ddlHour');
    var ddlMinute= document.getElementById('ctl00_ctn1_ddlMinute');
 
     if(ddlHour.value != '0' && ddlMinute.value!='0')
     {
          ReturnValue=true;
          arguments.IsValid = true;
     }
     else
     {
          ReturnValue=false;
          arguments.IsValid = false;
     }
    return ReturnValue;
}



// Created By : Girish Sharma
// Created Date : 23-11-2007
// Function : GroupBookingSearchPnlShow()
// Input : 
// Module : Super/GroupBooking.aspx
// Purpose : To Check which Type of Search User Wants and Set Visiablity

function GroupBookingSearchPnlShow(ddlSearchBy,DivSearchDate,DivSearchText)
{
    var ddlSearch=document.getElementById(ddlSearchBy);
    var DivDate=document.getElementById(DivSearchDate);
    var DivText=document.getElementById(DivSearchText);
    if(ddlSearch !=null)
    {
        if(ddlSearch.value==0)
        {
            DivDate.style.display = 'none';  
            DivText.style.display = 'none';  
        }
        else if(ddlSearch.value==1)
        {
            DivDate.style.display = 'block';  
            DivText.style.display = 'none';  
        }
        else if(ddlSearch.value==2)
        {
            DivDate.style.display = 'block';  
            DivText.style.display = 'none';  
        }
        else if(ddlSearch.value==3)
        {
            DivDate.style.display = 'none';  
            DivText.style.display = 'block';  
        }
    }
}

// Created By : Girish Sharma
// Created Date : 23-11-2007
// Function : IsRequireGroupBookingSearchCriteriaByText()
// Input : 
// Module : Super/GroupBooking.aspx
// Purpose : To Check Is Search criteria  Text Specify or Not

function IsRequireGroupBookingSearchCriteriaByText(source, arguments)
{
    var EbizTxtSearch=document.getElementById('ctl00_ctn1_EbizTxtSearch');
    var TxtSearch=trim(EbizTxtSearch.value);
    var ddlSearch=document.getElementById('ctl00_ctn1_ddlSearchBy');
    if(ddlSearch.value==3)
        { 
            if(TxtSearch.length > 0)
            {
               arguments.IsValid = true;
                return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
       }
      else if(ddlSearch.value==0 || ddlSearch.value==1 || ddlSearch.value==2)
      {
            arguments.IsValid = true;
            return true;
      }
      else
        {   
            arguments.IsValid = false;
            return false;
        }
}

// Created By : Girish Sharma
// Created Date : 23-11-2007
// Function : IsRequireGroupBookingSearchCriteriaByDate()
// Input : 
// Module : Super/GroupBooking.aspx
// Purpose : To Check Is Search criteria Date is Specify or Not
function IsRequireGroupBookingSearchCriteriaByDate(source, arguments)
{
    var EBizTxtDate=document.getElementById('ctl00_ctn1_EBizTxtDate');
    var EBizDate=trim(EBizTxtDate.value);
    var ddlSearch=document.getElementById('ctl00_ctn1_ddlSearchBy');
    if(ddlSearch.value==1 || ddlSearch.value==2)
        { 
            if(EBizDate.length > 0)
            {
               arguments.IsValid = true;
                return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
       }
      else if(ddlSearch.value==0 || ddlSearch.value==3)
      {
            arguments.IsValid = true;
            return true;
      }
      else
        {   
            arguments.IsValid = false;
            return false;
        }
}

// Created By : Girish Sharma
// Created Date : 23-11-2007
// Function : GroupAdminGroupBookingSearchPnlShow()
// Input : 
// Module : Group/GroupBooking.aspx
// Purpose : To Check which Type of Search User Wants and Set Visiablity

function GroupAdminGroupBookingSearchPnlShow(ddlSearchBy,DivSearchDate,DivSearchText)
{
    var ddlSearch=document.getElementById(ddlSearchBy);
    var DivDate=document.getElementById(DivSearchDate);
    var DivText=document.getElementById(DivSearchText);
    if(ddlSearch !=null)
    {
    if(ddlSearch.value==0)
    {
        DivDate.style.display = 'none';  
        DivText.style.display = 'none';  
    }
    else if(ddlSearch.value==1)
    {
        DivDate.style.display = 'block';  
        DivText.style.display = 'none';  
    }
    else if(ddlSearch.value==2)
    {
        DivDate.style.display = 'none';  
        DivText.style.display = 'block';  
    }
   }
}



// Created By : Girish Sharma
// Created Date : 23-11-2007
// Function : IsRequireGroupAdminSearchCriteriaByDate()
// Input : 
// Module : Group/GroupBooking.aspx
// Purpose : To Check Is Search criteria Date is Specify or Not
function IsRequireGroupAdminSearchCriteriaByDate(source, arguments)
{
    var EBizTxtDate=document.getElementById('ctl00_ctn1_EBizTxtDate');
    var EBizDate=trim(EBizTxtDate.value);
    var ddlSearch=document.getElementById('ctl00_ctn1_ddlSearchBy');
  
    if(ddlSearch.value==1)
        { 
            if(EBizDate.length > 0)
            {
               arguments.IsValid = true;
                return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
            
       }
      else if(ddlSearch.value==0 || ddlSearch.value==2)
      {
            arguments.IsValid = true;
            return true;
      }
      else
        {   
            arguments.IsValid = false;
            return false;
        }
}


function CheckItem(sender, args)
{     
     
    
    var options = document.getElementById('ctl00_ctn1_ctlAddNewUser_chkAllowed');    
    var arrayOfCheckBoxes = options.getElementsByTagName("input");

    var ischecked=false;    
    args.IsValid =false; 
   
    for(i=0;i< arrayOfCheckBoxes.length;i++)    
    { 
        
        var opt = arrayOfCheckBoxes[i];  
            
        if(opt.type=="checkbox")        
        {  
                           
            if(opt.checked)           
             {  
                  
                 ischecked= true;                
                 args.IsValid = true;    
             }
                 
        }     
    }
}

function PrintAffiliatesTermsNConditions(ctlContent,callingfrom)
{ 
 
    var content_vlue = document.getElementById(ctlContent).innerHTML; 
    var docprint=window.open('','name','width=750,height=600,left=160,top=80,menubar=no,toolbar=no,scrollbars=Yes,resizable=no,dependent=no'); 
    docprint.document.open(); 
    docprint.document.write('<html><head><title>Hostel/Hotel Terms & Conditions</title>');
    
    if (callingfrom == 'admin')
    {
        docprint.document.write('<link href="../../App_Themes/Default/Default.css" type="text/css" rel="stylesheet" />');    
        docprint.document.write('<script src="../../Script/Default.js" type="text/javascript" language="javascript"></script>');       
    }     
    else
    {        
        docprint.document.write('<link href="../App_Themes/Default/Default.css" type="text/css" rel="stylesheet" />');    
        docprint.document.write('<script src="../Script/Default.js" type="text/javascript" language="javascript"></script>');    
    }
    docprint.document.write('</head><body class="div-backcolor-ffffff">');
    docprint.document.write('<form id="form1" runat="server"><div class="div-float-left" style="width:750px;">');
    if (callingfrom =='admin')
        docprint.document.write('<div class="member-inner-full-bottom-icon"><img src="../../Images/Member/icon.gif" title="Smart Back Packers" alt="Smart Back Packers" /></div>');
    else
        docprint.document.write('<div class="member-inner-full-bottom-icon"><img src="../Images/Member/icon.gif" title="Smart Back Packers" alt="Smart Back Packers" /></div>');
        
    docprint.document.write('<div class="member-inner-full-bottom-heading">Hostel/Hotel Terms & Conditions<br /></div>');
    docprint.document.write('<div class="clear">&nbsp;</div><br /><br /><br />');
    docprint.document.write('<div id="content" class="div-default-text" style="padding-left: 50px;" runat="server">');
    docprint.document.write(content_vlue);
    docprint.document.write('</div>');
    docprint.document.write('<div class="clear">&nbsp;</div><br />');
    docprint.document.write('<div class="div-float-left" id="DivButtos" style="width:550px;padding-left:300px;">');
    docprint.document.write('<div class="div-float-left" style="width:95px;"><a class="home-footer" href="#" onclick="javascript:window.close();">[Close Window]</a></div>');
    docprint.document.write('<div class="div-float-left" style="width:3px;padding-left:5px;">|</div>');
    docprint.document.write('<div class="div-float-left" style="width:45px;"><a class="home-footer" href="#" onclick="javascript:PrintMe();">[Print]</a></div>');
    docprint.document.write('<div class="clear">&nbsp;</div><br /><br /><br /></div></div>');
    docprint.document.write('</form></body></html>');
    docprint.document.close(); 
    docprint.focus(); 
    return false;
}
function PrintoptionsExtras(ctlContent)
{ 
      
    var content_vlue = document.getElementById(ctlContent).innerHTML;        
    var docprint=window.open('','name','width=750,height=600,menubar=no,toolbar=no,scrollbars=Yes,resizable=no,dependent=no'); 
    
    docprint.document.open(); 
    docprint.document.write('<html><head><title>Option Extras</title>');
   docprint.document.write('<link href="../App_Themes/Default/Default.css" type="text/css" rel="stylesheet" />');    
   docprint.document.write('<script src="../Script/Default.js" type="text/javascript" language="javascript"></script>');    
    
    docprint.document.write('</head><body class="div-backcolor-ffffff">');
    docprint.document.write('<form id="form1" runat="server"><div class="div-float-left" style="width:750px;">');    
    docprint.document.write('<div class="clear">&nbsp;</div><br /><br /><br />');
    docprint.document.write('<div id="content" class="div-default-text" style="padding-left: 60px;" runat="server">');
    docprint.document.write(content_vlue);
    docprint.document.write('</div>');
    docprint.document.write('<div class="clear">&nbsp;</div><br />');
    docprint.document.write('<div class="div-float-left" id="DivButtos" style="width:550px;padding-left:300px;">');
    docprint.document.write('<div class="div-float-left" style="width:95px;"><a class="home-footer" href="#" onclick="javascript:window.close();">[Close Window]</a></div>');
    docprint.document.write('<div class="div-float-left" style="width:3px;padding-left:5px;">|</div>');
    docprint.document.write('<div class="div-float-left" style="width:45px;"><a class="home-footer" href="#" onclick="javascript:PrintMe();">[Print]</a></div>');
    docprint.document.write('<div class="clear">&nbsp;</div><br /><br /><br /></div></div>');
    docprint.document.write('</form></body></html>');
    docprint.document.close(); 
    docprint.focus();
     
    return false;
}

function PrintDetails(ctlContent,callingfrom,BookingRefNumber,PageTitle)
{ 
  if (callingfrom == 'admin')
    {       
        window.open('../../popup/printpopup.aspx?Content='+ctlContent+'&from='+callingfrom+'&RefNumber='+BookingRefNumber+'&title='+PageTitle,'name','width=750,height=650,left=160,top=80,menubar=no,toolbar=no,scrollbars=Yes,resizable=no,dependent=no'); 
    }
     else
    {
        
      window.open('../popup/printpopup.aspx?Content='+ctlContent+'&from='+callingfrom+'&RefNumber='+BookingRefNumber+'&title='+PageTitle,'name','width=750,height=650,left=160,top=80,menubar=no,toolbar=no,scrollbars=Yes,resizable=no,dependent=no'); 
    }  

   return false;
    
    
}

// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : ShowMemberQuote()
// Input : 
// Module : Member/GrpBookHistory.aspx;
// Purpose : To Display Member Quote Div

function ShowMemberQuote(AncharMemberQuote,divMemberQuote,DivQuote,pnlQuote)
{     

    var DivQuoteID= document.getElementById(DivQuote);
    var pnlQuoteID= document.getElementById(pnlQuote);
    var AncharMemberQuoteID= document.getElementById(AncharMemberQuote);
    var AncharMemberQuoteText = AncharMemberQuoteID.firstChild.data;  
    var divMemberQuoteID = document.getElementById(divMemberQuote);
      
      if(AncharMemberQuoteText == 'Quote') 
        {   
            AncharMemberQuoteID.firstChild.data = 'Close Quote'; 
            divMemberQuoteID.style.display = 'block';
            
            DivQuoteID.style.display = 'block'; 
            pnlQuoteID.style.display = "none";
        }
      if(AncharMemberQuoteText == 'Close Quote')
       {              
            AncharMemberQuoteID.firstChild.data = 'Quote';
            divMemberQuoteID.style.display = 'none';
            
            DivQuoteID.style.display = 'none'; 
            pnlQuoteID.style.display = "block";
           
       }}

            function checkEmail() 
		    {
		        
				if((emailAddr.value == null) || (emailAddr.value == ''))
				 	{				 
						alert("Please enter E-Mail Id.");
						return (false);
					}
				else if((passwd.value == null) || (passwd.value == ''))
				   {				   
				   		alert("Please enter Password.");
						return (false);
				   }				
				else if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailAddr.value))
					{
						return (true)
					}
				else
					{		
						alert("Invalid E-mail Address! Please re-enter.")
						return (false)
					}
		}
		
		
		function passValue()
		{
			
			document.forms["postcard"].action = "http://localhost:2944/smartbackpackers/member/memberreg1.aspx";
			document.forms["postcard"].submit();
			return true;
		}

function SubmitPage(txtPassword, btnSubmit)
{
    if(event.which || event.keyCode)
    {
        if ((event.which == 13) || (event.keyCode == 13)) 
        {
            if(document.getElementById(txtPassword).value != '')
              {
                //document.getElementById(btnSubmit).disabled = false;
                document.getElementById(btnSubmit).click();
                return false;
              }
              else
              {
                alert('Please enter keyword to search.');
                return false;
              }
              
        }
        else
        {
            return true;
        }
    }
}


function SubmitLogin(evt,username,password,btn)
{
    var k;
    if(evt.which)
        k = evt.which;
    else
        k = evt.keyCode;
        
    if (k == 13)
    {
        var txtUserName =document.getElementById(username);
        var txtPassword =document.getElementById(password);
        var btnSubmit =document.getElementById(btn);
        
        if((txtPassword.value != '') && (txtUserName.value != ''))
          {
            btnSubmit.focus();
            return true;
          }
          else
          {
            if ((txtUserName.value == '') && (txtPassword.value == ''))
            {
                alert('Please enter user name & password.');
                return false;
            }
            else if ((txtUserName.value == '') && (txtPassword.value != ''))
            {
                alert('Please enter user name.');
                return false;
            }
            else if ((txtUserName.value != '') && (txtPassword.value == ''))
            {   
                return false;
            }
          }
          
    }
    else
    {
        return true;
    }
}
 
 function CreditCardDetailsSubmit(evt)
{
    var k;
    if(evt.which)
        k = evt.which;
    else
        k = evt.keyCode;
    if (k == 13)
    {
       var btnSubmit ="btnPwd_btnChild";
       document.getElementById(btnSubmit).focus();
       return true;
    }
    else
    {
        return true;
    }
}
// Created By : Girish Sharma
// Created Date : 31-12-2007
// Function : ShowGroupBookingMessage()
// Input : 
// Module : Super/GroupBookingEnquire.aspx
// Purpose : 
function ShowGroupBookingMessage(divTxtMessage,divlblMessage,ImgBtnView,ImgBtnClose)
{
    var TxtMessage= document.getElementById(divTxtMessage);
    var lblMessage= document.getElementById(divlblMessage);
    var ImgClose= document.getElementById(ImgBtnClose);
    var ImgView= document.getElementById(ImgBtnView);
    TxtMessage.style.display = 'block'; 
    lblMessage.style.display = 'none'; 
    ImgClose.style.display = 'block'; 
    ImgView.style.display = 'none';
}

// Created By : Girish Sharma
// Created Date : 31-12-2007
// Function : CloseGroupBookingMessage()
// Input : 
// Module : Super/GroupBookingEnquire.aspx
// Purpose :
 
function CloseGroupBookingMessage(divTxtMessage,divlblMessage,ImgBtnView,ImgBtnClose)
{
    var TxtMessage= document.getElementById(divTxtMessage);
    var lblMessage= document.getElementById(divlblMessage);
    var ImgView= document.getElementById(ImgBtnView);
    var ImgClose= document.getElementById(ImgBtnClose);
    TxtMessage.style.display = 'none'; 
    lblMessage.style.display = 'block'; 
    ImgView.style.display = 'block'; 
    ImgClose.style.display = 'none'; 
}


function ChangeAllCheckBoxListStates(chkid,checkboxlistid)
{
	  var checkboxid = document.getElementById(chkid); 
      var chkid = document.getElementById(checkboxlistid);    
      var arrayOfCheckBoxes = chkid.getElementsByTagName("input");                
          for (var i = 0; i < arrayOfCheckBoxes.length; i++)                   
            {    
                if(arrayOfCheckBoxes[i].type == "checkbox" || arrayOfCheckBoxes[i].type == "CHECKBOX")
                   if(checkboxid.checked)
                         {
                             arrayOfCheckBoxes[i].checked = true;               
		                 }  
		           else
                         {
                            arrayOfCheckBoxes[i].checked = false; 
                         }                                            
            }            
 }

function EnableEnterAreaTextBox(checkboxlistid,TxtEnterArea)
{ 
   var chkid = document.getElementById(checkboxlistid);  
   var TxtArea=document.getElementById(TxtEnterArea);
   var arrayOfCheckBoxes = chkid.getElementsByTagName("input");  
   for (var i = 0; i < arrayOfCheckBoxes.length; i++)                   
        {    
            if(arrayOfCheckBoxes[i].type == "checkbox" || arrayOfCheckBoxes[i].type == "CHECKBOX")
            {
                 if(arrayOfCheckBoxes[i].name=='ctl00$ctn1$ChklstAccommodationSelection$6')
                 {
                    if(arrayOfCheckBoxes[i].checked == true)
                    { 
                        TxtArea.disabled=false;
                    }
                    else
                    {
                        TxtArea.disabled=true;
                        TxtArea.value='';
                    }
                 }  
            }
        }      
 }
 
 function EnableEnterAreaTextBoxSuper(checkboxlistid,TxtEnterArea)
{ 
   var chkid = document.getElementById(checkboxlistid);  
   var TxtArea=document.getElementById(TxtEnterArea);
   var arrayOfCheckBoxes = chkid.getElementsByTagName("input");  
   for (var i = 0; i < arrayOfCheckBoxes.length; i++)                   
        {    
            if(arrayOfCheckBoxes[i].type == "checkbox" || arrayOfCheckBoxes[i].type == "CHECKBOX")
            {
                 if(arrayOfCheckBoxes[i].name=='ctl00$ctn1$ChklstAccommodationSelection$6')
                 {
                    if(arrayOfCheckBoxes[i].checked == true)
                    { 
                        TxtArea.disabled=false;
                    }
                    else
                    {
                        TxtArea.disabled=true;
                        TxtArea.value='';
                    }
                 }  
            }
        }      
 }
//function ChangeAllCheckBoxListStates(chkid,checkboxlistid)
//{
//	  var checkboxid = document.getElementById(chkid); 
//      var chkid = document.getElementById(checkboxlistid);    
//      var arrayOfCheckBoxes = chkid.getElementsByTagName("input");                
//          for (var i = 0; i < arrayOfCheckBoxes.length; i++)                   
//            {    
//                if(arrayOfCheckBoxes[i].type == "checkbox" || arrayOfCheckBoxes[i].type == "CHECKBOX")
//                   if(checkboxid.checked)
//                         {
//                             arrayOfCheckBoxes[i].checked = true;               
//		                 }  
//		           else
//                         {
//                            arrayOfCheckBoxes[i].checked = false; 
//                         }                                            
//            }            
// }
 
 
 function IsAnnouncement(source, arguments)
{     
          
         var checkboxid =document.getElementById('ctl00_ctn1_chkAll');
             var IsTrue=false;
         var chkid =document.getElementById('ctl00_ctn1_cblForProperty');       
         var arrayOfCheckBoxes = chkid.getElementsByTagName("input");
         var panelid = document.getElementById('ctl00_ctn1_pnlPropertyCheckBoxList');         
          if(panelid.style.display != 'none')
           {
                
               if(checkboxid.checked == false)
               {
                         
                    for (var i = 0; i < arrayOfCheckBoxes.length; i++)                   
                    {    
                               
                        if(arrayOfCheckBoxes[i].type == "checkbox" || arrayOfCheckBoxes[i].type == "CHECKBOX")
                            
                          {       
 
                                 
                             if(arrayOfCheckBoxes[i].checked == true)
                                {
                                       IsTrue = true;                                      
                                        break;                                                 
		                         }  
		                     else
                                {
                                   IsTrue =false;                            
                                }                            
                          }
                     }
              }              
              else
              {
                   IsTrue = true;                                                  
              }              
           }
           else           
           {
              IsTrue = true;                                                 
           }
           
            if( IsTrue== true)
            {
                   arguments.IsValid = true;                                      
                    return true;                                                
             }  
         else
            {
                arguments.IsValid =false;                            
                return false;  
            }       
}


function CheckAnnouncemnetEditorLength()
{     
    
    var IsOK;
    var DescText;
    var DescHTML;    
    IsOK=true;
       
    for(var i=0;i<2;i++)
    {       
         _text=(/(microsoft|opera)/i.test(navigator.appName)) ? window.frames[i][0].document.body.innerText : window.frames[i][0].document.body.textContent;  
        DescText=   _text;               
        DescHTML = window.frames[i][0].document.body.innerHTML;          
        if(DescText.length = '0')
        {                      
	                         	              
	         alert("Please insert Description.");	                 
	         IsOK=false;	               
        }
        if(IsOK == false)
          {
              return false;            
          }
       else
           {
             continue;
           }
     }    
}

function IsSearchHostelCode(source, arguments)
{
    var EbizTxtSearch=document.getElementById('ctl00_ctn1_EbizTxtSearchHostelCode');
    var TxtSearch=trim(EbizTxtSearch.value);
    var ddlSearch=document.getElementById('ctl00_ctn1_dpPropertyName');   
    if(ddlSearch.value==5)
        { 
            if(TxtSearch.length > 0)
            {
               arguments.IsValid = true;
                return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
       }
      else if(ddlSearch.value==0 || ddlSearch.value==1 || ddlSearch.value==2 || ddlSearch.value==3 || ddlSearch.value==4)
      {
            arguments.IsValid = true;
            return true;
      }
      else
        {   
            arguments.IsValid = false;
            return false;
        }
}


function  ProeprtyAdminSearchPnlShow(ddlSearchBy,DivSearchText)
{
     
    var ddlSearch=document.getElementById(ddlSearchBy);    
    var DivText=document.getElementById(DivSearchText);
         
    if(ddlSearch !=null)
    {
        if(ddlSearch.value==0)
        {           
            DivText.style.display = 'none';  
        }
        else if(ddlSearch.value==1)
        {
            
            DivText.style.display = 'none';  
        }
        else if(ddlSearch.value==2)
        {           
            DivText.style.display = 'none';  
        }
        else if(ddlSearch.value==3)
        {            
            DivText.style.display = 'none';  
        }
         else if(ddlSearch.value==4)
        {           
            DivText.style.display = 'none';  
        }
         else if(ddlSearch.value==5)
        {    
            DivText.style.display = 'block'; 
            
        }
    }
}


function Isothersshow(ddlenquiryRegards,Divtxtother)
{     
    var ddlenquiry=document.getElementById(ddlenquiryRegards);    
    var DivText =document.getElementById(Divtxtother);
    var textboxother =document.getElementById('ctl00_ctn1_txtothers');
    
    if(ddlenquiry !=null)
    {
        if(ddlenquiry.value==0)
        {           
            DivText.style.display = 'none';  
        }
        else if(ddlenquiry.value==1)
        {
            
            DivText.style.display = 'none';  
        }
        else if(ddlenquiry.value==2)
        {
           
            DivText.style.display = 'none';  
        }
        else if(ddlenquiry.value==3)
        {            
            DivText.style.display = 'none';  
        }
         else if(ddlenquiry.value==4)
        {           
            DivText.style.display = 'none';  
        }
         else if(ddlenquiry.value==5)
        {    
            DivText.style.display = 'none'; 
            
        }
         else if(ddlenquiry.value==6)
        {    
            DivText.style.display = 'none'; 
            
        }
         else if(ddlenquiry.value==7)
        {    
           
            DivText.style.display = 'block';
             textboxother.value = ''; 
            
            
        }
    }
}


function IsOtherstxt(source, arguments)
{
    var EbizTxtother=document.getElementById('ctl00_ctn1_txtothers');
    var Txtother=trim(EbizTxtother.value);
    var ddlenquiry=document.getElementById('ctl00_ctn1_ddlEnquiryRegards');   
    if(ddlenquiry.value==7)
        { 
            if(Txtother.length > 0)
            {
               arguments.IsValid = true;
                return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
       }
      else if(ddlenquiry.value==0 || ddlenquiry.value==1 || ddlenquiry.value==2 || ddlenquiry.value==3 || ddlenquiry.value==4 || ddlenquiry.value==5 || ddlenquiry.value==6)
      {
            arguments.IsValid = true;
            return true;
      }
      else
        {   
            arguments.IsValid = false;
            return false;
        }
}

function _slsTrim(stringToTrim)
{
    try{return stringToTrim.replace(/^\s+|\s+$/g,"");}
    catch(ex){}
}


function checkdate(SelectedDate)
{
    var validformat=/^\d{1,2}\/\d{1,2}\/\d{4}$/; //Basic check for format validity
    var returnval=false;

    if(!validformat.test(SelectedDate))
    {
        returnval=false;
        //alert("Invalid Date Format. Please correct and submit again.")
    }
    else
    { 
        //Detailed check for valid date ranges
        var monthfield=SelectedDate.split("/")[1];
        var dayfield=SelectedDate.split("/")[0];
        var yearfield=SelectedDate.split("/")[2];
        var dayobj = new Date(yearfield, monthfield-1, dayfield);
        if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield))
        {
            //alert("Invalid Day, Month, or Year range detected. Please correct and submit again.")
            returnval==false;
         }
        else
        returnval=true;
    }
    return returnval;
}



function LockChar(evt)
{  
   evt = (evt) ? evt : ((event) ? event : null); 
   var charCode = (evt.charCode) ? evt.charCode : evt.keyCode
   
	if( ((charCode >= 48) && (charCode <= 57)) || (charCode==46) || (charCode==8)|| (charCode==9)|| (charCode==116))
	{  
		return true;
    }
	else
	{
		return false;
	}
}

function ValidationGroupBookingDetails(source, arguments)
{   
    
    // Shared Beds validation
    var NO=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_1');
    var YES=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_0');
    var SharedBeds=document.getElementById('ctl00_ctn1_EBizTxtNoOfSharedBeds');
    var NoofMale=document.getElementById('ctl00_ctn1_EBizTxtNoOfmale');
    var NoOfFemal=document.getElementById('ctl00_ctn1_EBizTxtNoOfFemale');    
    var IsTrue=false;
    
    if (isNaN(parseFloat(NoofMale.value))) 
     {
        NoofMale = 0;  
     }
     else
     {
        NoofMale = parseFloat(NoofMale.value);     
     }
      
     if (isNaN(parseFloat(NoOfFemal.value))) 
     {
        NoOfFemal = 0;  
     }
     else
     {
        NoOfFemal = parseFloat(NoOfFemal.value);     
     }
      
     if (isNaN(parseFloat(SharedBeds.value))) 
     {
        SharedBeds = 0;  
     }
     else
     {
        SharedBeds = parseFloat(SharedBeds.value);     
     } 
    
    var TotalSharedPeople= NoofMale + NoOfFemal;         
    
    if(YES.checked==true)
    {  
        if(TotalSharedPeople == SharedBeds)
        {
            IsTrue=true;
        }
        else
        {
            IsTrue=false;
        }
    }
    else
    {
        IsTrue=true;
    }   
        // Single Room
        var SingleRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfSingleRoom');
        var TwinRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfTwinRoom');
        var DoubleRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfDoubleRoom');
        var Adults=document.getElementById('ctl00_ctn1_EBizTxtNoOfAdults');
        var Children=document.getElementById('ctl00_ctn1_EBizTxtNoOfChildren');
         if (isNaN(parseFloat(SingleRoom.value))) 
         {
            SingleRoom = 0;  
         }
        else
        {
            SingleRoom = parseFloat(SingleRoom.value);     
        } 
        if (isNaN(parseFloat(TwinRoom.value))) 
        {
            TwinRoom = 0;  
         }
        else
        {
            TwinRoom = parseFloat(TwinRoom.value)* 2;    
        }
        if (isNaN(parseFloat(DoubleRoom.value))) 
        {
            DoubleRoom = 0;  
         }
        else
        {
            DoubleRoom = parseFloat(DoubleRoom.value)* 2;    
        } 
                
        var TotalOtherBeds=SingleRoom + TwinRoom + DoubleRoom;
        var TotalBeds=TotalOtherBeds + SharedBeds;        
        if (isNaN(parseFloat(Adults.value))) 
        {
            Adults = 0;  
         }
        else
        {
            Adults = parseFloat(Adults.value);    
        } 
        if (isNaN(parseFloat(Children.value))) 
        {
            Children = 0;  
         }
        else
        {
            Children = parseFloat(Children.value);    
        } 
         
        var TotalPerson= Adults + Children;
       
       
        if(IsTrue==true)
        {
            if(TotalPerson==TotalBeds)
            {
                IsTrue=true;
            }
            else
            {
                IsTrue=false;
            }
         }
         else
         {
          IsTrue=false;
         }
         
          if( IsTrue==true)
          {
             arguments.IsValid = true;
             return true;
          }
          else
          {   
            arguments.IsValid = false;
            return false;
          }
}





function ValidationGroupBookingAdultCheck(source, arguments)
{
      // Total Person
        //Adults
        var Adults=document.getElementById('ctl00_ctn1_EBizTxtNoOfAdults');
        
        if (isNaN(parseFloat(Adults.value))) 
        {
            Adults = 0;  
        }
        else
        {
            Adults=parseFloat(Adults.value);
	    }
        
        
        //Children
        var Children=document.getElementById('ctl00_ctn1_EBizTxtNoOfChildren');
        
        if (isNaN(parseFloat(Children.value))) 
        {
            Children = 0;  
        }
        else
        {
            Children=parseFloat(Children.value);
	    }        
        
        
        
        if(Children >0 && Adults==0)
        {
            arguments.IsValid = false;
            return false;
        }
        else
        {
            arguments.IsValid = true;
             return true;
        }
}

function CheckDOB(source, arguments)
{
    var CurrentDate=''
    var SelectedDate=''
    for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("hfCurrentDate")>0)
                { 
                    CurrentDate=elm.value;  
                }
         }
         
          for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("EBizTxtDOB")>0)
                { 
                    SelectedDate=elm.value;  
                }
         }
    if(_slsTrim(SelectedDate) !='')   
    {   
        if(checkdate(SelectedDate)==true)
        {
            if (true==CheckLessThanToCurrentDate(SelectedDate,CurrentDate) )
            {
                 arguments.IsValid = true;
                 return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
         }
         else
         {
            arguments.IsValid = false;
            return false;
         }
    }
    else
    {
        arguments.IsValid = true;
        return true;
    }
}


function CheckLessThanToCurrentDate(SelectedDate,CurrentDate)
{
    var IsTrue=false;
    var FromDate = CurrentDate.split('/');
	var FirstYear 	 = parseFloat(FromDate[2]);
	var FirstMonth	 = parseFloat(FromDate[1]);
	var FirstDate	 = parseFloat(FromDate[0]);
	
	var ToDate = SelectedDate.split('/');
	var SecondYear 	 = parseFloat(ToDate[2]);
	var SecondMonth	 = parseFloat(ToDate[1]);
	var SecondDate	 = parseFloat(ToDate[0]);
      
    if(SecondYear < FirstYear)
    {
        IsTrue = true;
    }
    else if(SecondYear > FirstYear)
    {
        IsTrue = false;
    }
    else
    {
	    if(SecondMonth < FirstMonth)
	    {
		   IsTrue = true;
	    }
	 	else if(SecondMonth > FirstMonth)
	    {
		   IsTrue = false;
	    }	
	    else
	    {
		    if(SecondDate < FirstDate)
		    { 
                IsTrue= true;
		    }
		    else     
		    {   
		        IsTrue = false;
		    }    		
	    }
    } 
    
    return  IsTrue;   
}

function ValidationGroupBookingMinPeopleCheck(source, arguments)
{
        for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("hfMinimumPeopleGroupBooking")>0)
                { 
                    MinimumPeopleGroupBooking=elm.value;  
                }
         }
         
         MinimumPeopleGroupBooking=parseFloat(MinimumPeopleGroupBooking)  ;
        // Total Person
        //Adults
        var Adults=document.getElementById('ctl00_ctn1_EBizTxtNoOfAdults');
        Adults=parseFloat(Adults.value);
        
        //Children
         var Children=document.getElementById('ctl00_ctn1_EBizTxtNoOfChildren');
        Children=parseFloat(Children.value);
        
        var TotalPeople=Adults + Children;
        if(TotalPeople <MinimumPeopleGroupBooking)
        {   
            arguments.IsValid = false;
            return false;
        }
        else
        {
            arguments.IsValid = true;
             return true;
        }
}


function IsShowChain(checkboxid,pnlid)
{  
    var CheckBoxID=document.getElementById(checkboxid);
    var PanelID=document.getElementById(pnlid);
    if(CheckBoxID !=null)
    {
        if(CheckBoxID.checked==true)
        {  
            PanelID.style.display = 'block';
        }
        else
        {  
            PanelID.style.display = 'none';
        }
    }
    else
        {  
            if(PanelID !=null)
            {
                PanelID.style.display = 'none';
             }
        }
}



function GroupBookingDayWisePriceClose(IdDayWisePrice,ImgBtnView,ImgBtnClose)
{

    var DayWisePrice=document.getElementById(IdDayWisePrice);
    var ImgClose= document.getElementById(ImgBtnClose);
    var ImgView= document.getElementById(ImgBtnView);
    DayWisePrice.style.display = 'none'; 
    ImgView.style.display = 'block';   
    ImgClose.style.display = 'none';
}

function GroupBookingDayWisePriceView(IdDayWisePrice,ImgBtnView,ImgBtnClose)
{
    var DayWisePrice=document.getElementById(IdDayWisePrice);
    var ImgClose= document.getElementById(ImgBtnClose);
    var ImgView= document.getElementById(ImgBtnView);
    DayWisePrice.style.display = 'block'; 
    ImgView.style.display = 'none';
    ImgClose.style.display = 'block'; 
}

function ViewPopupGroupBookingQuoteDeatils(url,PRPMID,BKMID,LoginUserId)
{
  var newwindow; 
   newwindow=window.open(url + '?PropertyID=' + PRPMID + '&BookingId=' +BKMID + '&LoginUserId=' +LoginUserId ,'name1','toolbar=no,location=0,menubar=no,scrollbars=yes,height=600,width=760,left=200,top=50');
    if (window.focus) {newwindow.focus();}
   return false;
}


// Create By : Girish Sharma
// Create Date : 6-08-2007
// Function : AddGroupBookingEnableDisableControls()
// Module :Super Admin
function AddGroupBookingEnableDisableControls(RbNewBooking,RbRefNumber,RbEmailId,EBizTxtBookRefNumber,EbizTxtEmail)
{
    var IdRbNewBooking= document.getElementById(RbNewBooking); 
    var IdRbRefNumber= document.getElementById(RbRefNumber); 
    var IdRbEmailId= document.getElementById(RbEmailId); 
       
    var IdEBizTxtBookRefNumber= document.getElementById(EBizTxtBookRefNumber); 
    var IdEbizTxtEmail= document.getElementById(EbizTxtEmail);
    if(IdRbNewBooking.checked)
    {

        IdEbizTxtEmail.disabled=true;
        IdEbizTxtEmail.style.background="#cccccc";
        
        IdEBizTxtBookRefNumber.disabled=true;
        IdEBizTxtBookRefNumber.style.background="#cccccc";
        IdEBizTxtBookRefNumber.value='';
        IdEbizTxtEmail.value='';
    }
    else if(IdRbRefNumber.checked)
    {

        IdEbizTxtEmail.disabled=true;
        IdEbizTxtEmail.style.background="#cccccc";
        
        IdEBizTxtBookRefNumber.disabled=false;
        IdEBizTxtBookRefNumber.style.background="#ffffff";
        IdEbizTxtEmail.value='';
    }
      else if(IdRbEmailId.checked)
    {

        IdEbizTxtEmail.disabled=false;
        IdEbizTxtEmail.style.background="#ffffff";
        
        IdEBizTxtBookRefNumber.disabled=true;
        IdEBizTxtBookRefNumber.style.background="#cccccc";
        IdEBizTxtBookRefNumber.value='';
    }
    
  
}


// Created By : Girish Sharma
// Created Date : 17-10-2007
// Function : IsShowSharedRoomPanelSuperAdmin()
// Input : 
// Module : Member/Grpbook1.aspx
// Purpose : If Shared Beds Required then show DivSharedRoom,else visiable=false
function IsShowSharedRoomPanelSuperAdmin(pnlSharedRoom)
{  
    var NO=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_1');
    var YES=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_0');
    var pnlSharedRoomDiv=document.getElementById(pnlSharedRoom);

    if(NO.checked==true)
    {  
        pnlSharedRoomDiv.style.display = 'none';
    }
    else if(YES.checked==true)
    {  
        pnlSharedRoomDiv.style.display = 'block';
    }
}


function ValidationGroupBookingDetailsSuperAdmin(source, arguments)
{  
    // Shared Beds validation
    var NO=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_1');
    var YES=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_0');
    var SharedBeds=document.getElementById('ctl00_ctn1_EBizTxtNoOfSharedBeds');    
    var IsTrue=false;
    var NoofMale=document.getElementById('ctl00_ctn1_EBizTxtNoOfmale');
    var NoOfFemal=document.getElementById('ctl00_ctn1_EBizTxtNoOfFemale');    
    
    if (isNaN(parseFloat(SharedBeds.value))) 
     {
        SharedBeds = 0;  
     }
     else
     {
        SharedBeds = parseFloat(SharedBeds.value);     
     }
    
     if (isNaN(parseFloat(NoofMale.value))) 
     {
        NoofMale = 0;  
     }
     else
     {
        NoofMale = parseFloat(NoofMale.value);     
     }
    
     if (isNaN(parseFloat(NoOfFemal.value))) 
     {
        NoOfFemal = 0;  
     }
     else
     {
        NoOfFemal = parseFloat(NoOfFemal.value);     
     }
     
     var TotalSharedPeople= NoofMale + NoOfFemal;
   
    if(YES.checked==true)
    {  
        if(TotalSharedPeople == SharedBeds)
        {
            IsTrue=true;
        }
        else
        {
            IsTrue=false;
        }
    }
    else
    {
        IsTrue=true;
    }
    
      
          if( IsTrue==true)
          {
             arguments.IsValid = true;
             return true;
          }
          else
          {   
            arguments.IsValid = false;
            return false;
          }
    
    
//        // Single Room
//        var SingleRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfSingleRoom');
//        SingleRoom=parseFloat(SingleRoom.value);
//        // Twin Room
//        var TwinRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfTwinRoom');
//        TwinRoom=parseFloat(TwinRoom.value) * 2;
//        // Double Room
//        var DoubleRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfDoubleRoom');
//        DoubleRoom=parseFloat(DoubleRoom.value) * 2;         
//         var TotalOtherBeds=SingleRoom + TwinRoom + DoubleRoom;
//        var TotalBeds=TotalOtherBeds + SharedBeds;
//        
//        // Total Person
//        //Adults
//        var Adults=document.getElementById('ctl00_ctn1_EBizTxtNoOfAdults');
//        Adults=parseFloat(Adults.value);
//        
//        //Children
//         var Children=document.getElementById('ctl00_ctn1_EBizTxtNoOfChildren');
//        Children=parseFloat(Children.value);
//        
//        var TotalPerson=Adults + Children;
//        if(IsTrue==true)
//        {
//            if(TotalPerson==TotalBeds)
//            {
//                IsTrue=true;
//            }
//            else
//            {
//                IsTrue=false;
//            }
//         }
//         else
//         {
//          IsTrue=false;
//         }
       
}


function ValidationGroupBookingDetailsMember(source, arguments)
{   
    var NO=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_1');
    var YES=document.getElementById('ctl00_ctn1_rblstIsSeperateRoomRequire_0');
    var SharedBeds=document.getElementById('ctl00_ctn1_EBizTxtNoOfSharedBeds');    
    var IsTrue=false;
    var NoofMale=document.getElementById('ctl00_ctn1_EBizTxtNoOfmale');
    var NoOfFemal=document.getElementById('ctl00_ctn1_EBizTxtNoOfFemale');    
    
    if (isNaN(parseFloat(SharedBeds.value))) 
     {
        SharedBeds = 0;  
     }
     else
     {
        SharedBeds = parseFloat(SharedBeds.value);     
     }
    
     if (isNaN(parseFloat(NoofMale.value))) 
     {
        NoofMale = 0;  
     }
     else
     {
        NoofMale = parseFloat(NoofMale.value);     
     }
    
     if (isNaN(parseFloat(NoOfFemal.value))) 
     {
        NoOfFemal = 0;  
     }
     else
     {
        NoOfFemal = parseFloat(NoOfFemal.value);     
     }
     
     var TotalSharedPeople= NoofMale + NoOfFemal;
   
    if(YES.checked==true)
    {  
        if(TotalSharedPeople == SharedBeds)
        {
            IsTrue=true;
        }
        else
        {
            IsTrue=false;
        }
    }
    else
    {
        IsTrue=true;
    }
    
      
          if( IsTrue==true)
          {
             arguments.IsValid = true;
             return true;
          }
          else
          {   
            arguments.IsValid = false;
            return false;
          }
}
function GroupBookingValidationSuperAdmin(source, arguments)
{
        var IsTrue=false;
        // Shared Beds
        var SharedBeds=document.getElementById('ctl00_ctn1_EBizTxtNoOfSharedBeds');
        
        if (isNaN(parseFloat(SharedBeds.value))) 
        {
            SharedBeds = 0;  
        }
        else
        {
            SharedBeds = parseFloat(SharedBeds.value);     
        }        
        // Single Room
        var SingleRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfSingleRoom');
        
        if (isNaN(parseFloat(SingleRoom.value))) 
        {
            SingleRoom = 0;  
        }
        else
        {
            SingleRoom=parseFloat(SingleRoom.value);     
        }    
        
        
        // Twin Room
        var TwinRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfTwinRoom');
        if (isNaN(parseFloat(TwinRoom.value))) 
        {
            TwinRoom = 0;  
        }
        else
        {
            TwinRoom=parseFloat(TwinRoom.value) * 2;    
        }       
        
        // Double Room
        var DoubleRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfDoubleRoom');
        if (isNaN(parseFloat(DoubleRoom.value))) 
        {
            DoubleRoom = 0;  
        }
        else
        {
            DoubleRoom=parseFloat(DoubleRoom.value) * 2;   
        }            
        var TotalOtherBeds=SingleRoom + TwinRoom + DoubleRoom;
        var TotalBeds=TotalOtherBeds + SharedBeds;
        
        // Total Person
        //Adults
        var Adults=document.getElementById('ctl00_ctn1_EBizTxtNoOfAdults');
         if (isNaN(parseFloat(Adults.value))) 
        {
            Adults = 0;  
        }
        else
        {
            Adults=parseFloat(Adults.value); 
        }        
        //Children
         var Children=document.getElementById('ctl00_ctn1_EBizTxtNoOfChildren');
        if (isNaN(parseFloat(Children.value))) 
        {
            Children = 0;  
        }
        else
        {
            Children=parseFloat(Children.value);
        }         
         
         
         
        var TotalPeoplInGroup=document.getElementById('ctl00_ctn1_EbizTxtTotalPeopleInGroup');
         
        if (isNaN(parseFloat(TotalPeoplInGroup.value))) 
        {
            TotalPeoplInGroup = 0;  
        }
        else
        {
            TotalPeoplInGroup=parseFloat(TotalPeoplInGroup.value); 
        }    
          
        
        var TotalPerson=Adults + Children;
        
        if((TotalBeds <=TotalPeoplInGroup && TotalPeoplInGroup >=SharedBeds))
        {
            IsTrue=true;
        }
        else
        {
             IsTrue=false;
        }
        
        if(TotalBeds ==0)
        {
            IsTrue=false;
        }
        
         if( IsTrue==true)
          {
             arguments.IsValid = true;
             return true;
          }
          else
          {   
            arguments.IsValid = false;
            return false;
          }
 
}

function GroupBookingCheckValidationMember(source, arguments)
{
        var IsTrue=false;
        // Shared Beds
        var SharedBeds=document.getElementById('ctl00_ctn1_EBizTxtNoOfSharedBeds');
        
        if (isNaN(parseFloat(SharedBeds.value))) 
        {
            SharedBeds = 0;  
        }
        else
        {
            SharedBeds = parseFloat(SharedBeds.value);     
        }        
        // Single Room
        var SingleRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfSingleRoom');
        
        if (isNaN(parseFloat(SingleRoom.value))) 
        {
            SingleRoom = 0;  
        }
        else
        {
            SingleRoom=parseFloat(SingleRoom.value);     
        }    
        
        
        // Twin Room
        var TwinRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfTwinRoom');
        if (isNaN(parseFloat(TwinRoom.value))) 
        {
            TwinRoom = 0;  
        }
        else
        {
            TwinRoom=parseFloat(TwinRoom.value) * 2;    
        }       
        
        // Double Room
        var DoubleRoom=document.getElementById('ctl00_ctn1_EBizTxtNoOfDoubleRoom');
        if (isNaN(parseFloat(DoubleRoom.value))) 
        {
            DoubleRoom = 0;  
        }
        else
        {
            DoubleRoom=parseFloat(DoubleRoom.value) * 2;   
        }            
        var TotalOtherBeds=SingleRoom + TwinRoom + DoubleRoom;
        var TotalBeds=TotalOtherBeds + SharedBeds;
        
        // Total Person
        //Adults
        var Adults=document.getElementById('ctl00_ctn1_EBizTxtNoOfAdults');
         if (isNaN(parseFloat(Adults.value))) 
        {
            Adults = 0;  
        }
        else
        {
            Adults=parseFloat(Adults.value); 
        }        
        //Children
         var Children=document.getElementById('ctl00_ctn1_EBizTxtNoOfChildren');
        if (isNaN(parseFloat(Children.value))) 
        {
            Children = 0;  
        }
        else
        {
            Children=parseFloat(Children.value);
        }         
         
         
        var TotalPeoplInGroup=document.getElementById('ctl00_ctn1_EbizTxtTotalPeopleInGroup');
         
        if (isNaN(parseFloat(TotalPeoplInGroup.value))) 
        {
            TotalPeoplInGroup = 0;  
        }
        else
        {
            TotalPeoplInGroup=parseFloat(TotalPeoplInGroup.value); 
        }    
        
        
        var TotalPerson =Adults + Children;
        
        if((TotalBeds <=TotalPeoplInGroup && TotalPeoplInGroup >=SharedBeds))
        {
            IsTrue=true;
        }
        else
        {
             IsTrue=false;
        }
        
        if(TotalBeds == 0)
        {
            IsTrue=false;
        }
        
         if( IsTrue==true)
          {
             arguments.IsValid = true;
             return true;
          }
          else
          {   
            arguments.IsValid = false;
            return false;
          }
 
}

function GroupBookingCheckTotalNumberOfPeople(source, arguments)
{
        var IsTrue=false;
        var TotalPeoplInGroup=document.getElementById('ctl00_ctn1_EbizTxtTotalPeopleInGroup');
         
        if (isNaN(parseFloat(TotalPeoplInGroup.value))) 
        {
            TotalPeoplInGroup = 0;  
        }
        else
        {
            TotalPeoplInGroup=parseFloat(TotalPeoplInGroup.value); 
        }    
        
        // Total Person
        //Adults
        var Adults=document.getElementById('ctl00_ctn1_EBizTxtNoOfAdults');
         if (isNaN(parseFloat(Adults.value))) 
        {
            Adults = 0;  
        }
        else
        {
            Adults=parseFloat(Adults.value); 
        }    
            
        //Children
         var Children=document.getElementById('ctl00_ctn1_EBizTxtNoOfChildren');
        if (isNaN(parseFloat(Children.value))) 
        {
            Children = 0;  
        }
        else
        {
            Children=parseFloat(Children.value);
        }  
         
        
        var TotalPerson=Adults + Children;
        
         if(TotalPeoplInGroup==TotalPerson)
         {
            IsTrue=true;
         }
        
         if( IsTrue==true)
          {
             arguments.IsValid = true;
             return true;
          }
          else
          {   
            arguments.IsValid = false;
            return false;
          }
 
}

 function EnterVote(val1,val2,rad,txt,ctrl)
    {   
        var aa = txt;
        if (txt != null)
        {   
            if (rad == 1)
            {
                txt.value = val1 + "/" + val2;     
            }
            else
            {
                var str = "*" + val1 + "/" + val2 + "#";
                
                if (txt.value.indexOf(str) < 0)
                {
                    if (ctrl.checked)
                    {
                        txt.value += str;
                    }
                }
                else
                {
                    if (!(ctrl.checked))
                    {
                        txt.value = txt.value.replace(str,"");
                    }
                }
            }
        }
        //alert(txt.value);
    }
    
    // Created By : Vishal Gupta
// Created Date : 19-03-2008
// Function : PageHeight_Common()
// Input : 
// Module : Common
// Purpose : Page Height Keeps maintain whenever User Search Controll Expands Itself or CommonDiv_HELL Expands Itself
function PageHeight_Common()
{
    //        var LeftControl1_pnldestguide=document.getElementById("ctl00_ctn1_LeftControl1_pnldestguide");
    //        LeftControl1_pnldestguide.style.height=0+ "px";
        var d = document.getElementById("Common_Div_HELL");
        var innersearch=document.getElementById("ctl00_ctn1_LeftControl1_cntSearch_div_inner_search_inner_control");       
        var advancsearch=document.getElementById("ctl00_ctn1_LeftControl1_cntSearch_div_Advance_SearchPanel");               
        if(d.offsetHeight>innersearch.offsetHeight+advancsearch.offsetHeight)
        {                
             outerdiv.style.height=d.offsetHeight+"px";             
        }
        else
        {               
            outerdiv.style.height=(innersearch.offsetHeight+advancsearch.offsetHeight)+"px";            
        }       
 }
 
 function Isfindusother(source, arguments)
{
    var EbizTxtSearch=document.getElementById('ctl00_ctn1_txtfindusother');
    var TxtSearch=trim(EbizTxtSearch.value);
    var ddlSearch=document.getElementById('ctl00_ctn1_ddlHowFindUs');   
    if(ddlSearch.value==16)
        { 
            if(TxtSearch.length > 0)
            {
               arguments.IsValid = true;
                return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
       }
      else if(ddlSearch.value != 16 )
      {
            arguments.IsValid = true;
            return true;
      }
      else
        {   
            arguments.IsValid = false;
            return false;
        }
}

function  GrpBookingPnlShow(ddlSearchBy,DivSearchText)
{
     
    var ddlSearch=document.getElementById(ddlSearchBy);    
    var DivText=document.getElementById(DivSearchText);         
    if(ddlSearch !=null)
    {
        if(ddlSearch.value==16)
        {           
            DivText.style.display = 'block'; 
        }
        else
        {            
            DivText.style.display = 'none';  
        }       
    }
} 

function  checkconfirmMessage(hidctrl)
{

//chkadmincomments,chkMemberComments,chkallowOffers,chkcontactdetailsdisplay,chkYieldManagement,chkResetadminPassword,chkismember,chkCanUpdateRatings
    var result = true ;
    var chkadmincomments=document.getElementById("ctl00_ctn1_chkadmincomments");
    var chkCanUpdateRatings=document.getElementById("ctl00_ctn1_chkCanUpdateRatings"); 
    var chkMemberComments=document.getElementById("ctl00_ctn1_chkMemberComments"); 
    var chkallowOffers=document.getElementById("ctl00_ctn1_chkallowOffers"); 
    var chkcontactdetailsdisplay=document.getElementById("ctl00_ctn1_chkcontactdetailsdisplay"); 
    var chkYieldManagement=document.getElementById("ctl00_ctn1_chkYieldManagement"); 
    var chkResetadminPassword=document.getElementById("ctl00_ctn1_chkResetadminPassword"); 
    var chkismember=document.getElementById("ctl00_ctn1_chkismember");
    var chkVAT=document.getElementById("ctl00_ctn1_chkIsVAT");
    var txthid = document.getElementById(hidctrl);
    if (txthid != null)
    {   
        if (txthid.value != "0")
        {
            var aHid = txthid.value.split(',') ;
            if(chkadmincomments.checked) 
            {
                if (aHid[1] == 0)
                {
                    result = confirm('Are you sure you want to activate "Hostel admin\'s reply for comments to be shown on website" feature ?');
                }
            }
            else if( ! (chkadmincomments.checked) )
            {
                if (aHid[1] == 1)
                {
                    result = confirm('Are you sure you want to inactivate "Hostel admin\'s reply for comments to be shown on website" feature ?');
                }
            }
            
            if (result == true)
            {
                if(chkMemberComments.checked) 
                {
                    if (aHid[2] == 0)
                    {
                        result = confirm('Are you sure you want to activate "Hostel admin can reply to member\'comments" feature ?');
                    }
                }
                else if(!(chkMemberComments.checked) )
                {
                    if (aHid[2] == 1)
                    {
                        result = confirm('Are you sure you want to inactivate "Hostel admin can reply to member\'comments" feature ?');
                    }
                }
            }
            
            if (result == true)
            {
                if(chkallowOffers.checked) 
                {
                    if (aHid[3] == 0)
                    {
                        result = confirm('Are you sure you want to activate "Is Offers allowed to hostels" feature ?');
                    }
                }
                else if(!(chkallowOffers.checked) )
                {
                    if (aHid[3] == 1)
                    {
                        result = confirm('Are you sure you want to inactivate "Is Offers allowed to hostels" feature ?');
                    }
                }
            }
                
            if (result == true)
            {
                if(chkcontactdetailsdisplay.checked) 
                {
                    if (aHid[4] == 0)
                    {
                        result = confirm('Are you sure you want to activate "Property contact details to be displayed on the website" feature ?');
                    }
                }
                else if(!(chkcontactdetailsdisplay.checked) )
                {
                    if (aHid[4] == 1)
                    {
                        result = confirm('Are you sure you want to inactivate "Property contact details to be displayed on the website" feature ?');
                    }
                }
            }
            
            if (result == true)
            {
                if(chkYieldManagement.checked) 
                {
                    if (aHid[5] == 0)
                    {
                        result = confirm('Are you sure you want to activate "Yield Management allowed to hostels" feature ?');
                    }
                }
                else if(!(chkYieldManagement.checked) )
                {
                    if (aHid[5] == 1)
                    {
                        result = confirm('Are you sure you want to inactivate "Yield Management allowed to hostels" feature ?');
                    }
                }
            }
            
            if (result == true)
            {
                if(chkResetadminPassword.checked) 
                {
                    if (aHid[6] == 0)
                    { 
                        result = confirm('Are you sure you want to activate "Reset Hostel Admin Password allowed to hostels" feature ?');
                    }
                }
                else if(!(chkResetadminPassword.checked) )
                {
                    if (aHid[6] == 1)
                    { 
                        result = confirm('Are you sure you want to inactivate "Reset Hostel Admin Password allowed to hostels" feature ?');
                    }
                }
            }
            
            if (result == true)
            {
                if(chkismember.checked) 
                {
                    if (aHid[7] == 0)
                    {
                        result = confirm('Are you sure you want to activate "Required login required for Payment" feature ?');
                    }
                }
                else if(!(chkismember.checked))
                {
                    if (aHid[7] == 1)
                    {
                        result = confirm('Are you sure you want to inactivate "Required login required for Payment" feature ?');
                    }
                }
            }
            
            if (result == true)
            {
                if (chkCanUpdateRatings.checked) 
                {
                    if (aHid[8] == 0)
                    {
                        result = confirm('Are you sure you want to activate "Hostel admin can update rating status" feature ?');
                    }
                }
                else if(!(chkCanUpdateRatings.checked) )
                {
                    if (aHid[8] == 1)
                    {
                        result = confirm('Are you sure you want to inactivate "Hostel admin can update rating status" feature ?');
                    }
                }
            }
            if (result == true)
            {
                if (chkVAT.checked) 
                {
                    if (aHid[9] == 0)
                    {
                        result = confirm('Are you sure you want to activate "Is VAT is applicable on Shipping" feature ?');
                    }
                }
                else if(!(chkVAT.checked) )
                {
                    if (aHid[9] == 1)
                    {
                        result = confirm('Are you sure you want to inactivate "Is VAT is applicable on Shipping" feature ?');
                    }
                }
            }
            
            return result;
         }
     }
}
 
 


function pageOffset() 
{
    var element = document.getElementById('layerName');
    var maxHeight = document.documentElement.scrollTop;
    var maxWidth = document.documentElement.scrollLeft;
    if (element != null)
    {
        if (maxWidth != 0)
        {
            element.style.posLeft = maxWidth;
        }
        else
        {
            element.style.posLeft = 750;
        }
        element.style.posTop = maxHeight + 48;
        element.style.height = 0;
        element.style.width = 0;
        setTimeout('pageOffset()',10);
    }
}

function SubmitQuickSearch(evt,btnSubmit)
{
    var k;
    if(evt.which)
        k = evt.which;
    else
        k = evt.keyCode;

    if (k == 13)
    {
        document.getElementById(btnSubmit).focus();
        return true;
    }
    else
    {
        return true;
    }
}


function checkemailid(emailid)
{
     var emailid = document.getElementById(emailid).value.split('#'); 
      var IsReturn = true;
        var Email1=trim(document.getElementById(emailid[0]).value);
        var Email2=trim(document.getElementById(emailid[1]).value);
        var Email3=trim(document.getElementById(emailid[2]).value);
        var Email4=trim(document.getElementById(emailid[3]).value);
        var Email5=trim(document.getElementById(emailid[4]).value);
    
        var Name1=trim(document.getElementById(emailid[5]).value);
        var Name2=trim(document.getElementById(emailid[6]).value);
        var Name3=trim(document.getElementById(emailid[7]).value);
        var Name4=trim(document.getElementById(emailid[8]).value);
        var Name5=trim(document.getElementById(emailid[9]).value);      
     
     
            if(Email1 == null && Email2 == null  &&   Email3 == null && Email4 ==null  &&   Email5 == null && Name1 == null  &&   Name2 == null && Name3 == null &&   Name4 == null &&  Name5 == null)
            {
                 alert('Please enter receiver name & receiver email');
                 return false;
            } 
            else
            {                   
                   for(var Item=0;Item<5;Item++)
                   {
                       IsReturn =  IsRequireemailId(emailid[Item+5],emailid[Item],Item);                       
                       if(IsReturn == true)
                       {
                            continue;                                              
                       }
                       else
                       {                   
                          return false;
                       }                    
                   }
                                
            }         
}



function IsRequireemailId(name,emailid,index)
{     
    var name=trim(document.getElementById(name).value);
    var emailid=trim(document.getElementById(emailid).value);
           
     if(name == null && emailid == null)
      {
         return true;        
      }
      else
      {      
        if(name != null || emailid != null)
        {
            if(name != null)
             {
                 if(emailid != null)
                 {
                    return true;
                 }
                 else
                 {
                    alert('Please enter receiver email in Row number' + (index+1).toString() );
                    return false;                 
                 }              
              }
            else
            {            
                alert('Please enter receiver name in Row number' + (index+1).toString());
                return false;
            }      
        }      
      }      
 }
 
 
function CheckEmailIdIsDiffrent(source, arguments)
{
  var IsValid=true;
  var txtEmailId = arguments.Value.split('#') ;

  for(var iItem=0;iItem<txtEmailId.length;iItem++)
  {
    for(var jItem=iItem+1;jItem<txtEmailId.length;jItem++)
        {
            var Item1=trim(document.getElementById(txtEmailId[iItem]).value);
            var Item2=trim(document.getElementById(txtEmailId[jItem]).value);
            if(Item1 != "" && Item2 != "")
            { 
             if(Item1 != null && Item2 != null)
                { 
                    if(Item1==Item2)
                    { 
                       IsValid=false;
                       break;
                    }
                    if(IsValid==false)
                    {
                        break;
                    }
                }
            }
        }
  }
  

    if(IsValid==false)
    {   
         source.errormessage="Same email id found within entered email id's.";
         arguments.IsValid = false;
         return false;
    }
    else
    {
         arguments.IsValid = true;
         return true;
    }
}














function IsRequireAffiliate(source, arguments)
 { 
      var IsValid=true;
      var NoOfCheckedRecord=0;
      var dgid = document.getElementById(arguments.Value); 
      if (dgid != null)
      { 
          for (var i = 0; i < dgid.rows.length - 1; i++)                   
            {      
                var chkBoxes  =  dgid.getElementsByTagName("input");
                if(chkBoxes !=null)
                {   
                    if(chkBoxes[i].type == "checkbox" || chkBoxes[i].type == "CHECKBOX")
                    {
                        if(chkBoxes[i].checked=='1') //True
                        {
                            NoOfCheckedRecord =NoOfCheckedRecord + 1;
                            if(NoOfCheckedRecord >1)
                            {
                                IsValid=false;
                            }
                        }
                    } 
                }
            }            
      }
      
      if(NoOfCheckedRecord >1)
      {
        source.errormessage="Please select only one record from list.";
      }
      else if(NoOfCheckedRecord==0)
      {
        IsValid=false;
        source.errormessage="Please select at least one record from list.";
      }
      
       if(IsValid==false)
        {    
             arguments.IsValid = false;
             return false;
        }
        else
        {
             arguments.IsValid = true;
             return false;
        }
}

function CheckProductQuantity(source, arguments)
{
   var IsValid=true;
   var Argument = arguments.Value.split('#') ;
   var chkOptionExtras=  document.getElementById(Argument[0]);
   var TxtQuantity=  _slsTrim(document.getElementById(Argument[1]).value);
   var ProductName=  Argument[2];
       if(chkOptionExtras.checked)
       {
            if(TxtQuantity !='' && parseFloat(TxtQuantity) >0)
            {
                 IsValid=true;
            }
            else
            {
                 IsValid=false;
            }
       }
       else
       {
            IsValid=true;
       }
   
   if(IsValid==false)
    {   
        if(TxtQuantity =='')
        {
         source.errormessage="Please enter Quantity for " + ProductName +".";
         arguments.IsValid = false;
         return false;
        }
         else
        {
          source.errormessage="Quantity should be more than 0 for " + ProductName +".";
          arguments.IsValid = false;
          return false;
        }
    }
    else
    {
         arguments.IsValid = true;
         return true;
    }
   
}


function CheckProductInputs(source, arguments)
{

   var IsValid=true;
   var Argument = arguments.Value.split('#') ;
   var chkOptionExtras=  document.getElementById(Argument[0]);
   var TxtProductInput=  _slsTrim(document.getElementById(Argument[1]).value);
   var ProductName=  Argument[2];
   var Question=  Argument[3];

   if(chkOptionExtras.checked)
   {  
        if(TxtProductInput !='')
        {
             IsValid=true;
        }
        else
        {
             IsValid=false;
        }
   }
   else
   {
        IsValid=true;
   }
   
   if(IsValid==false)
    {   
         source.errormessage="Please enter " +  Question + " for " + ProductName +".";
         arguments.IsValid = false;
         return false;
    }
    else
    {
         arguments.IsValid = true;
         return true;
    }
   
}

function EnableDisableTextBoxForVAT(chkID,txtID)
{
       
    var tt = window.document.getElementById(chkID);
    if(tt.checked == true)
    {        
       window.document.getElementById(txtID).readOnly=false;           
       window.document.getElementById(txtID).focus();
    } 
    else
    {          
        window.document.getElementById(txtID).readOnly=true;
     
    }   
}

function IsRequireVATPercentage(source, arguments)
{     
      var intVAT='';
    
      var chkVAT=document.getElementById('ctl00_ctn1_chkIsVAT');
      
        for(i = 0; i < document.forms[0].elements.length; i++)
         {
            elm = document.forms[0].elements[i]
         
            if (elm.type == 'text') 
            { 
                if(elm.name.indexOf("txtvatpercentage")>0)
                { 
                    intVAT=elm.value;
                }
                
               
            }
         }          
            if(chkVAT.checked)
            {
                 if(intVAT.length ==0)
                 {  
                    arguments.IsValid = false;
                        return false;
                 }
             }    
}


function disableVATIncludedCheckBox(chk)
{
    var chkVATIncluded= document.getElementById(chk);
    chkVATIncluded.disabled = true;
}

function ValidateProduct(ddlSup,ddlCat,txtwt,ddlwt,txtwid,ddlwid,txtlen,ddllen,txthgt,ddlhgt,txtqty,pmid,lblqty,chkqty)
{
    var txtqty =  document.getElementById(txtqty);
    var lblqty =  document.getElementById(lblqty);
    var varpmid =  document.getElementById(pmid);
    var chkqty = document.getElementById(chkqty);
    var pmval = 0;
    if (varpmid != null)
    {
        pmval = parseInt(varpmid.value);
    }
    if(txtqty.value.length > 0)
    {
        if (chkqty.checked)
        {
            if (parseInt(pmval) == 0)
            {
                if (parseInt(txtqty.value) == 0)
                {
                    alert('Please enter quantity.');
                    return false;
                } 
            }
            else
            {
                if ((parseInt(txtqty.value) == 0) && (parseInt(lblqty.innerHTML) == 0))
                {
                    alert('Quantity should be greater than ZERO.');
                    return false;
                } 
            
            }
        }
    }
//    else
//    {
//        alert('Please enter quantity.');
//        return false;
//    }

    var ddlCategory =  document.getElementById(ddlCat);
    if(parseInt(ddlCategory.value) == 0)
    {   
        alert('Please select category.');
        return false;
    }
    
    var ddlSupplier =  document.getElementById(ddlSup);
    if(parseInt(ddlSupplier.value) == 0)
    {   
        alert('Please select supplier.');
        return false;
    }
    
    var txtWeight =  document.getElementById(txtwt);
    var ddlWeight =  document.getElementById(ddlwt);
    if(txtWeight.length > 0)
    {
        if (txtWeight.value > 0)
        {
            if(parseInt(ddlWeight.value) == 0)
            {   
                alert('Please select unit for weight.');
                return false;
            }
        }
    }
    
    var txtWidth =  document.getElementById(txtwid);
    var ddlWidth =  document.getElementById(ddlwid);
    if(txtWidth.length > 0)
    {
        if (txtWidth.value > 0)
        {
            if(parseInt(ddlWidth.value) == 0)
            {   
                alert('Please select unit for width (volume).');
                return false;
            }
        }
    }
    
    var txtLenth =  document.getElementById(txtlen);
    var ddlLenth =  document.getElementById(ddllen);
    if(txtLenth.length > 0)
    {
        if (txtLenth.value > 0)
        {
            if(parseInt(ddlLenth.value) == 0)
            {   
                alert('Please select unit for lenth (volume).');
                return false;
            }
        }
    }
    
    var txtHeight =  document.getElementById(txthgt);
    var ddlHeight =  document.getElementById(ddlhgt);
    if(txtHeight.length > 0)
    {
        if (txtHeight.value > 0)
        {
            if(parseInt(ddlHeight.value) == 0)
            {   
                alert('Please select unit for height (volume).');
                return false;
            }
        }
    }
        
    return true;
}

function ChangeVATIncludedStatus(chkVA,chkVI)
{
    var chkVATApplicable= document.getElementById(chkVA);
    var chkVATIncluded= document.getElementById(chkVI);
    

    if ((chkVATApplicable != null) && (chkVATIncluded != null))
    {
        if(chkVATApplicable.checked)
        {
            chkVATIncluded.disabled = false;
        }
        else
        { 
            chkVATIncluded.disabled = true;
        }
    }
}

function ShowHideProductPanels(pnlRedeem,chkRedeem,pnlNB,chkNB,pnlTax,rbTax,pnlMultiPrice,chkMultiPrice,pnlGB,chkGB,chkship,btnship,txtPM,chkqty,minqty,relevel,reqty,txtqty)
{  
    var pnlRedeem=document.getElementById(pnlRedeem);
    var chkRedeem= document.getElementById(chkRedeem);
    var vpnlNB=document.getElementById(pnlNB);
    var vchkNB= document.getElementById(chkNB);
    var pnlTax=document.getElementById(pnlTax);
    var rbTaxYes= document.getElementById(rbTax+'_0');
    var chkMultiPrice=document.getElementById(chkMultiPrice);
    var pnlMultiPrice=document.getElementById(pnlMultiPrice);
    var chkGB= document.getElementById(chkGB);
    var pnlGB= document.getElementById(pnlGB);
    var chkship= document.getElementById(chkship);
    var btnship= document.getElementById(btnship);
    var txtPM= document.getElementById(txtPM);
    var chkqty=document.getElementById(chkqty);
    var minqty= document.getElementById(minqty);
    var relevel=document.getElementById(relevel);
    var reqty= document.getElementById(reqty);
    var txtqty= document.getElementById(txtqty);

    if (chkRedeem != null)
    {
        if(chkRedeem.checked)
        {
            pnlRedeem.style.display = "";
        }
        else
        { 
            pnlRedeem.style.display = "none";
        }
    }
    if (vchkNB != null)
    {
        if(vchkNB.checked)
        {
            vpnlNB.style.display = "";
        }
        else
        { 
            vpnlNB.style.display = "none";
        }
    }   
    if (rbTaxYes != null)
    {
        if(rbTaxYes.checked)
            pnlTax.style.display = "";
        else
            pnlTax.style.display = "none";
    }
    if (chkMultiPrice != null)
    {
        if(chkMultiPrice.checked)
        {
            pnlMultiPrice.style.display = "";
        }
        else
        { 
            pnlMultiPrice.style.display = "none";
        }
    }   
    if (chkGB != null)
    {
        if(chkGB.checked)
        {
            pnlGB.style.display = "";
        }
        else
        { 
            pnlGB.style.display = "none";
        }
    }  
    if (chkship != null)
    {
        if (parseInt(txtPM.value)>0)
        {
            if(chkship.checked)
            {
                btnship.style.display = "none";
            }
            else
            { 
                btnship.style.display = "";
            }
        }
        else
        {
            btnship.style.display = "none";
        }
    } 
    if (chkqty != null)
    {
        if(chkqty.checked)
        {
            minqty.disabled = false;
            relevel.disabled = false;
            reqty.disabled = false;
            txtqty.disabled = false;
        }
        else
        { 
            minqty.disabled = true;
            relevel.disabled = true;
            reqty.disabled = true;
            txtqty.disabled = true;
            txtqty.value = "0";
        }    
    }
}

function  CheckLogin(memberid)
{
   

 if(parseInt(memberid) == 0)
    {
        alert('Please login to go to your cart from the user login panel.');
        return false;
    }
}


function IsMultiLeverlPricing(txt)
{
    var txt = document.getElementById(txt);
    if (txt != null)
    {
        if (txt.value != "")
        {
            if (parseInt(txt.value) > 1)
            {
                return true; 
            }
            else
            {
                alert('Quantity for multi level pricing should be greater than 1. Please enter again!');
                return false;
            }
        }
        else
        {
            alert('Please enter quantity.');
            return false;
        }
    }
}

//FUNCTION FOR SHOPPING CART
function SelectShipping(ddl,lbl,lbltot,lblgtot,txtgtot)
{
    var lbl = document.getElementById(lbl);
    var ddl = document.getElementById(ddl);
    var txtgtot = document.getElementById(txtgtot);
    var lbltot = document.getElementById(lbltot);
    var lblgtot = document.getElementById(lblgtot);
    var lblpay = document.getElementById(lblpay);
    var val = ddl.options[ddl.selectedIndex].value.split('_'); 
    
    var gtot=0;
    if (ddl.options.length > 1)
    {
        if (ddl.selectedIndex > 0)
        {
            if (val.length > 0)
	        {
		        lbl.innerHTML = val[0];
		        gtot = parseFloat(val[0]) + parseFloat(lbltot.innerHTML);
		        lblgtot.innerHTML = RoundNumber(gtot);
		        //lblpay.innerHTML = RoundNumber(gtot);
		        txtgtot.value = RoundNumber(gtot);
            }
        }
        else
        {   
            lbl.innerHTML = '0.00';
            gtot = parseFloat(lbltot.innerHTML);
            lblgtot.innerHTML = RoundNumber(gtot);
            //lblpay.innerHTML = RoundNumber(gtot);
            txtgtot.value = RoundNumber(gtot);
            
        }
    }
    else
    {
        lbl.innerHTML = '0.00';
        gtot = parseFloat(lbltot.innerHTML);
        lblgtot.innerHTML = RoundNumber(gtot);
        //lblpay.innerHTML = RoundNumber(gtot);
        txtgtot.value = RoundNumber(gtot);
    }

    return true;
}
              
function CheckShopProductQuantity(txtenter,txtfind,bln)
{
  
    if (bln == 1)
    {
           
        var txtenter = document.getElementById(txtenter);
        var txtfind = document.getElementById(txtfind);       
        var re3digit = new RegExp("^[0-9]{1,3}$");

        //var re3digit=/^\d{3}$/ 
       
        if ((txtenter != null) && (txtfind != null))
        {
             
             if (txtenter.value.length == 0)
            {
                alert('Please enter quantity.');
                return false;
            }
             
            if (re3digit.test(txtenter.value) == false) //if match failed
            {
               alert("Please check quantity.")
                return false;
            }
             
           
            if (parseInt(txtenter.value)==0)
            {
                alert('Quantity should be greater than ZERO.');
                return false;
            }
             
            if (parseInt(txtenter.value) > parseInt(txtfind.value))
            { 
                alert('Quantity cannot be more than ' + txtfind.value + '. Please enter again!');
                return false;
            }            
            return true;
        }
    }
    else
    {
        alert('Please login to add items in your cart from the user login panel.');
        var login = document.getElementById('ctl00_ucLogin_txtUserName');
        login.focus();
        return false;
    }
}
function HideProductInputsPanel(pnl,txthid,image,imgopen)
{
    if (document.getElementById(pnl) != null)
    {
        document.getElementById(pnl).style.display = "none";
    }
    if (document.getElementById(txthid) != null)
    {
        document.getElementById(txthid).value = "0";
    }
    if (document.getElementById(image) != null)
    {
        document.getElementById(image).src = imgopen;
    }
}
function ShowHideProductInputsPanel(pnl,txthid,image,imgclose,imgopen)
{
    var txthid= document.getElementById(txthid);
    if (txthid.value == "0")
    {
        document.getElementById(pnl).style.display = "";
        txthid.value = "1";
        document.getElementById(image).src = imgclose;
    }
    else
    {
        document.getElementById(pnl).style.display = "none";
        txthid.value = "0";
        document.getElementById(image).src = imgopen;
    }
    return false;
}


function CheckNewsletterSenddate(source, arguments)
{
   
    var CurrentDate=''
    var SelectedDate=''
    for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("hfCurrentDate")>0)
                { 
                    CurrentDate=elm.value;  
                }
         }
         
          for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("txtsenddate")>0)
                { 
                    SelectedDate=elm.value;  
                }
         }
    if(_slsTrim(SelectedDate) !='')   
    {   
        if(checkdate(SelectedDate)==true)
        {
            if (true==CheckMoreThanCurrentDate(SelectedDate,CurrentDate) )
            {
                 arguments.IsValid = true;
                 return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
         }
         else
         {
            arguments.IsValid = false;
            return false;
         }
    }
    else
    {
        arguments.IsValid = true;
        return true;
    }
}


function CheckMoreThanCurrentDate(SelectedDate,CurrentDate)
{
    var IsTrue=false;
    var FromDate = CurrentDate.split('/');
	var FirstYear 	 = parseFloat(FromDate[2]);
	var FirstMonth	 = parseFloat(FromDate[1]);
	var FirstDate	 = parseFloat(FromDate[0]);
	
	var ToDate = SelectedDate.split('/');
	var SecondYear 	 = parseFloat(ToDate[2]);
	var SecondMonth	 = parseFloat(ToDate[1]);
	var SecondDate	 = parseFloat(ToDate[0]);
      
    if(SecondYear > FirstYear)
    {
        IsTrue = true;
    }
    else if(SecondYear < FirstYear)
    {
        IsTrue = false;
    }
    else
    {
	    if(SecondMonth > FirstMonth)
	    {
		   IsTrue = true;
	    }
	 	else if(SecondMonth < FirstMonth)
	    {
		   IsTrue = false;
	    }	
	    else
	    {
		    if(SecondDate > FirstDate)
		    { 
                IsTrue= true;
		    }
		    else     
		    {   
		        IsTrue = false;
		    }    		
	    }
    } 
    
    return  IsTrue;   
}

function CheckNewsletterFromdate(source, arguments)
{
   
    var CurrentDate=''
    var SelectedDate=''
    for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("hfCurrentDate")>0)
                { 
                    CurrentDate=elm.value;  
                }
         }
         
          for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("txtstartDate")>0)
                { 
                    SelectedDate=elm.value;  
                }
         }
    if(_slsTrim(SelectedDate) !='')   
    {   
        if(checkdate(SelectedDate)==true)
        {
            if (true==CheckMoreThanEqualToCurrentDate(SelectedDate,CurrentDate) )
            {
                 arguments.IsValid = true;
                 return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
         }
         else
         {
            arguments.IsValid = false;
            return false;
         }
    }
    else
    {
        arguments.IsValid = true;
        return true;
    }
}


function checkchkstate(chkcntry,chkstate,chkcity)
{
 var chkcntryid = document.getElementById(chkcntry);
 var chkstateid = document.getElementById(chkstate);
 var chkcityid =  document.getElementById(chkcity);
   
 if( chkcntryid.checked || chkstateid.checked || chkcityid.checked)
   {
              
   }
   else
   {
    alert('Please check atleast one checkbox.') ;
     return false;
   
   }
}


function CheckEventdisplaydate(source, arguments)
{
    
    var CurrentDate=''
    var SelectedDate=''
    for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("hfCurrentDate")>0)
                { 
                    CurrentDate=elm.value;  
                }
         }
         
          for(i = 0; i < document.forms[0].elements.length; i++)
         {              
            var elm = document.forms[0].elements[i]           
            if(elm.name.indexOf("ctrlTxtDisplayDate")>0)
                { 
                    SelectedDate=elm.value;  
                }
         }
    if(_slsTrim(SelectedDate) !='')   
    {   
        if(checkdate(SelectedDate)==true)
        {
            if (true==CheckMoreThanEqualToCurrentDate(SelectedDate,CurrentDate) )
            {
                 arguments.IsValid = true;
                 return true;
            }
            else
            {
                arguments.IsValid = false;
                return false;
            }
         }
         else
         {
            arguments.IsValid = false;
            return false;
         }
    }
    else
    {
        arguments.IsValid = true;
        return true;
    }
}

//////////////////
function ShowHideAffiliate(pnlHide,rbType,lblLink)
{
    var pnlImg=document.getElementById(pnlHide);
    var rbType= document.getElementById(rbType+'_2');
    var lblLink= document.getElementById(lblLink);
    if (rbType != null)
    {
        if(rbType.checked)
        {
            pnlImg.style.display = "none";
            lblLink.style.display = "";
        }
        else
        {
            pnlImg.style.display = "";
            lblLink.style.display = "none";
        }
    }
}

function ValidateAffiliateMaster(txtafid,txtimg,txtfup,ddlurl,rbType)
{
    var txtafid = document.getElementById(txtafid);
    var txtimg = document.getElementById(txtimg);
    var txtwid = document.getElementById(txtwid);
    var txthgt = document.getElementById(txthgt);
    var txtfup = document.getElementById(txtfup);
    var ddlurl = document.getElementById(ddlurl);
    var rbType= document.getElementById(rbType+'_2');
    var find = 0;
    
    if (rbType != null)
    {
        if(rbType.checked)
        {
            find = 1;
        }
    }
    if (find == 0)
    {
        if (parseInt(txtafid.value) >0)
        {
            if ((txtimg.value == "") && (txtfup.value == ""))
            {
                alert('Please select image');
                return false;
            }
        }
        else
        {
            if (txtfup.value == "")
            {
                alert('Please select image');
                return false;
            }
        }
    }
    
    if(parseInt(ddlurl.value) == 0)
    {
        alert('Please select Open URL.');
        return false;
    }
    return true;
}

function PrintFrame(targetFrame)
{
targetFrame.focus();
targetFrame.print();
return false;
}

function AdjustScrolling(id)
{
    var id = document.getElementById(id);
    var top = 0;
    if (document.compatMode && document.compatMode != "BackCompat")
        top = document.documentElement.scrollTop;
    else
        top = document.body.scrollTop;

    if(id != null)
    {
        id.style.top = top + 'px';
    }
} 

//window.onscroll = AdjustScrolling('IdProgressBar');


//Ajax State
function GetStateAjax(strURL,strCtrlCountryID,strCtrlStateID,strCtrlCityID,flag)
{
    var valCountryID=document.getElementById(strCtrlCountryID).value;
    var valCityID = document.getElementById(strCtrlCityID);   
    var flag =   flag;   
    if(flag == 1)
    {   
        valCityID.options.length = 0; 
    }
    
    GetResultsForState(strURL,valCountryID,strCtrlStateID,flag,valCityID);
}

function GetResultsForState(strURL,strCountryID,strCtrlStateID,flag,ddlCity)
{
    var flag =   flag;    
    var valUrl;
    if(flag == 1)
    {   
      valUrl=strURL+"?CountryID="+strCountryID+"&tranID=" + GetRandomNumber()+"&flag=" +flag;
      doRequest(valUrl);
	  FillState(strCtrlStateID,a,'^');
	  ddlCity.options[0]= new Option("-Select City-","0");
    }
    else
    {
      valUrl=strURL+"?StateId="+strCountryID+"&tranID=" + GetRandomNumber()+"&flag=" +flag;
      doRequest(valUrl);
	  FillState(strCtrlStateID,a,'^');
    } 
           
            
    
}

function FillState(strCtrlStateID,values,delimiter)
{
	if (values)
	{
		var a = new Array();
		ddlState = null;
		
		a = values.split(delimiter);

		ddlState = document.getElementById(strCtrlStateID);
        var oIndex=0;
        for(oIndex=0;oIndex < (ddlState.options.length);)
        {
            ddlState.remove(oIndex);
        }

        var oCount;
        oIndex=0;
        for(oCount=0; oCount< (a.length-1); ++oCount)
        {
            var oOptionData = a[oCount].split("~");
            ddlState.options[oIndex]= new Option(oOptionData[0],oOptionData[1]);
            oIndex++;
        }
	}
}

function ChangeMap(ddlmaplist,panelimagemap,panelgooglemap)
{   
   
    var ddlmaplist=document.getElementById(ddlmaplist);    
    var panelimagemap=document.getElementById(panelimagemap);
    var panelgooglemap=document.getElementById(panelgooglemap);      
         
    if((ddlmaplist !=null) ||  (panelimagemap !=null) || (panelgooglemap !=null))
    { 
        
        if(ddlmaplist.value==1)
        {        
           
            panelgooglemap.style.display = 'block';
            panelimagemap.style.display = 'none';    
        }
        else if(ddlmaplist.value==2)
        {            
           
            panelimagemap.style.display = 'block';  
            panelgooglemap.style.display = 'none';
        }
         else if(ddlmaplist.value==0)
        {            
           
            panelimagemap.style.display = 'none';  
            panelgooglemap.style.display = 'none';
        }
       
       
    }
}

function RegisterGoogleMap(ddlmaplist,panelimagemap,panelgooglemap)
{
    var ddlmaplist=document.getElementById(ddlmaplist);    
    var panelimagemap=document.getElementById(panelimagemap);
    var panelgooglemap=document.getElementById(panelgooglemap);      
         
    if((ddlmaplist !=null) ||  (panelimagemap !=null) || (panelgooglemap !=null))
    { 
       
        if(ddlmaplist.value==1)
        {        
           
            panelgooglemap.style.display = 'block';
            panelimagemap.style.display = 'none';    
        }
        else if(ddlmaplist.value==2)
        {            
           
            panelimagemap.style.display = 'block';  
            panelgooglemap.style.display = 'none';
        }
         else if(ddlmaplist.value==0)
        {            
           
            panelimagemap.style.display = 'none';  
            panelgooglemap.style.display = 'none';
        }      
       
    }


}


function GetCustomerReview(url,obj)
{   
    var filter=jQuery('#'+obj).val();
    jQuery.get(url, {ID:filter,RNumber: GetRandomNumber()},
      function(data){
        var Filterdata=GetStringFromHTML(data);
        jQuery("#divCustomerReview").empty().html(Filterdata);
        //jQuery("div.admintab-inner").filter(":last").empty();
    });

}

 function GetStringFromHTML(strResult)
{
    var strStartToken = "[dvOutputStart]";
    var strEndToken = "[dvOutputEnd]";
    
    return GetStringFromHTMLWithToken(strResult, strStartToken, strEndToken);
}

function GetStringFromHTMLWithToken(strResult, strStartToken, strEndToken)
{
    var intStart = strResult.indexOf(strStartToken)
    
    var intEnd = strResult.indexOf(strEndToken)
    
    intStart = parseInt(intStart) + strStartToken.length;
    
    intEnd = parseInt(intEnd);
    
    strResult = strResult.substring(intStart,intEnd);
	
	return strResult;
}

function CheckValidBookingDateHostelSearch(source, arguments)
{     
    var Isvalid=false; 
    var strDateFrom='';
    var strDateTo='';
    var DateTo='';
     for(i = 0; i < document.forms[0].elements.length; i++)
     {              
         var elm = document.forms[0].elements[i];
         if(elm.name.indexOf("TxtSelectedValue")>0)
            { 
                DateTo=elm.value;
                var strDate = DateTo.split('#');
   
                var Year 	 = parseFloat(document.getElementById(strDate[2]).value);
                var Month	 = parseFloat(document.getElementById(strDate[1]).value);
                var Date	 = parseFloat(document.getElementById(strDate[0]).value);
                strDateTo=Date+'/'+ Month +'/'+ Year;
            }
     }

	
	var ToDate = strDateTo.split('/');
	var SecondYear 	 = parseFloat(ToDate[2]);
	var SecondMonth	 = parseFloat(ToDate[1]);
	var SecondDate	 = parseFloat(ToDate[0]);
      
   if(SecondMonth==2)
   {    
        if(SecondDate <=29 && checkYear(SecondYear)==1)
        {
            Isvalid=true;
        }
        else if(SecondDate <=28)
        {
            Isvalid=true;
        }
        else
        {
            Isvalid=false;
        }
   }
   else
   {
    Isvalid=true;
   }
   
   if(Isvalid)
   {
    arguments.IsValid = true;
    return true;
   }else
   {
    arguments.IsValid = false;
    return false;    
   }
}

// Leap Year

function checkYear(year) { 
    return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? 1 : 0;
}

function CheckShipping(ddlShipping)
{
    var ddlShip = document.getElementById(ddlShipping);
    if (ddlShip != null)
    {
        if (ddlShip.options.length > 1)
        {
            if (ddlShip.selectedIndex < 1)
            {
                alert('Please select Shipping.');
                return false;
            }
            else
            {
                var Shipping = ddlShip.options[ddlShip.selectedIndex].value;
                if (trim(Shipping) != "-1")
                {
                    if ((Shipping.length > 0) && (trim(Shipping) != "0"))
                    {
                        return true;
                    }
                    else
                    
                    {
                        return false;
                    }
                }
            }  
        }      
    }
}