//** Animated Collapsible DIV v2.0- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** May 24th, 08'- Script rewritten and updated to 2.0.
//** June 4th, 08'- Version 2.01: Bug fix to work with jquery 1.2.6 (which changed the way attr() behaves).
var start_address;
var end_address;
var email_id=0;
var email_type;
var trip_id=0;
var trip_type;
var mytrip_map=0;
var global_mytrips_map=0;
var mytrips_g_day_map=0;
var directionId;
var StartEnd;
var addressStr="";
var dayFlag=0;
var addressAvailavel=0;
var animatedcollapse={
divholders: {}, //structure: {div.id, div.attrs, div.$divref}
divgroups: {}, //structure: {groupname.count, groupname.lastactivedivid}
lastactiveingroup: {}, //structure: {lastactivediv.id}

hidetripbottommap:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {
   id=divids;
   id=id.replace("mapl","");
   $("#show_map_div"+id).css('display','block');
   $("#hide_map_div"+id).css('display','none');
  this.showhide(divids, "hide");
  }
},

showtripbottommap:function(divids){ //public method
  if (typeof divids=="object"){
  this.showhide(divids[0], "show");

  }
  else
  {
   //alert(divids);
    id=divids;
   id=id.replace("mapl","");
   var address=$("#"+id+"mapadd").html();
   address=address.replace("<b>Address:</b>&nbsp;","");
   address=address.replace("<B>Address:</B>&nbsp;","");//for IE
   address=address.replace("<b>Pick-up Address:</b>&nbsp;","");//for car
   address=address.replace("<B>Pick-up Address:</B>&nbsp;","");//for IE
   if($("#"+id+"email_itdiv").css("display")=="block")
  animatedcollapse.hideemaildiv(id+"email_itdiv");


   var title=$("#"+id+"trip_title").html();
   title=title.replace(". ","");
   title=removeHTMLTags(title);
   $("#titlediv").html(title);
   if(address!="")
   { 
      newaddress=0; 
     $("#newaddress").attr("value",address);
     $("#show_map_div"+id).css('display','none');
      $("#hide_map_div"+id).css('display','block');
      $("#"+id+"directions").css("display","none");
      this.showhide(divids, "show");
      $("#"+id+"map_des").attr("value",0);
      $("#"+id+"map_src").attr("value",0);
      $("#editaddresslink").text("edit address");
      $("#oldaddress").html(address+" -");
      $("#pridestore").show();
      setTimeout(function(){initialize(id+"mapldiv");showAddress(address,title,divids);},1000); 
   }  
   else
   {
     if(invite==0)
     {
      $("#editaddresslink").text("add address");
      $("#oldaddress").html("");
      $("#pridestore").hide();
      tb_show("","#TB_inline?height=280&amp;width=524&amp;inlineId=itemmappopup&modal=true", "false")
      $(".sendnewaddress").attr("id",id.replace("mapl","newaddress"));
      tb_init('a.thickbox');
    }
    else
    {
      $('#alertErrorText').text("Item address not specified.");
      errormsg("alertError");
    } 
   }   
  }
},

hidetripmap:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {
    $.cookie('tripmap', 2, { path: '/', expires: 365 });
    $("#planhidemap").css('display','none');
    $("#planshowmap").css('display','block');
    this.showhide(divids, "hide");
  }
},
hidedaymap:function(divids){ //public method
  if (typeof divids=="object"){
    var id=divids[0];
    id=id.replace("daymap","");
    $("#daymap_s"+id).css('display','block');
    $("#daymap_h"+id).css('display','none');
    this.showhide(divids[0], "hide")
  }
  else
  {
    this.showhide(divids, "hide");
  }
},

showdaymap:function(divids){ //public method
  if (typeof divids=="object"){
    var id=divids[0];
    id=id.replace("daymap",""); 
    $("#daymap_h"+id).css('display','block');
    $("#daymap_s"+id).css('display','none');
    this.showhide(divids[0], "show")
    mytrips_g_day_map=0;
    addressCounter=0;
    setTimeout(function(){initialize_multimarker_day(id,divids[1]);},500);
  }
  else
  {
    this.showhide(divids, "show");
  }
},
showtripmap:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")

  }
  else
  {
    if(trp_address.length==0)
    {
      $('#alertErrorText').text("No addresses found in this trip.");
      errormsg("alertError");
    }
    else
    {
    $.cookie('tripmap', 1, { path: '/', expires: 365 });
    $("#planhidemap").css('display','block');
    $("#planshowmap").css('display','none');
    this.showhide(divids, "show");
    str1="";
    var week=1;
    var count=1;
    var week_count=1;
    addressCounter=0;
    setTimeout(function(){initialize_multimarker(0);},500);
    map_check();
    }
  }
},
showtripcal:function(divids, anchor){ //public method
	
	$.cookie('tripcal', 1, { path: '/', expires: 365 });show_cal=1;
	
	$("#planhidecal").css('display','block');
	$("#planshowcal").css('display','none');

	if ($.cookie('tripmap') == 1 && anchor == 1) {
		$('#'+divids).slideDown(400, function() {
			$('html,body').scrollTop($('#'+divids).offset().top);
		});
	}
	else {
		$('#'+divids).slideDown();
	}

	if (cal_y_ && cal_m_){
		// alert(cal_y_); alert(cal_m_);
		$('#calendar').fullCalendar('gotoDate', cal_y_, cal_m_);		
	}else{
		//alert("else");
	}
	cal_y_ = 0;
	cal_m_ = 0;	
},
hidetripcal:function(divids){ //public method
	try{	
		$.cookie('tripcal', 2, { path: '/', expires: 365 });show_cal=0;
	}catch(e){}
	
	$("#planhidecal").css('display','none');
	$("#planshowcal").css('display','block');
	$("#calendar_").slideUp();
},
hideadditem:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {

    var arrowname = divids;
     arrowname =arrowname.replace("addanitemdiv","");
    $("#hideadditem"+arrowname).css('display','none');
    $("#showadditem"+arrowname).css('display','block');
    this.showhide(divids, "hide");
  }
},

showadditem:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {

    var arrowname = divids;
     arrowname =arrowname.replace("addanitemdiv","");
    $("#hideadditem"+arrowname).css('display','block');
    $("#showadditem"+arrowname).css('display','none');
    this.showhide(divids, "show");
  }
},

show:function(divids){ //public method
  if (typeof divids=="object"){
    var arrowname = '#'+divids[0]+'down';
    $(arrowname).css('display','block');
    arrowname = '#'+divids[0]+'right';
    $(arrowname).css('display','none');
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {
    var arrowname = '#'+divids+'down';
    $(arrowname).css('display','block');
    arrowname = '#'+divids+'right';
    $(arrowname).css('display','none');

    this.showhide(divids, "show");
  }
},
showtripdetaildirection:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {
  var type=divids;
  if(type.indexOf("parent")!=-1)
  {
    
    var id=type.replace("parent","");
    $("#right"+id).css("display","none");
    $("#less"+id).css("display","block");
    $("#full"+id).css("display","none");
    $("#down"+id).css("display","block");
    $("#child"+id).css("display","none");
    $("#print"+id).css("display","block");
    $("#navcontainer"+id).css("display","block");
    var iaddress=$("#iadd"+id).html();
    var faddress=$("#fadd"+id).html();
    faddress=faddress.replace("<b>Address:</b>&nbsp;","");
    iaddress=iaddress.replace("<b>Address:</b>&nbsp;","");
    setDirections(iaddress,faddress,1,"en_US");
    $("#"+id+"trip_title").hide();
    $("#"+id+"trip_title_less").show();
    directionId=id;
    this.showhide("navcontainerdiv"+id, "show");
    if(iaddress!="")
    {  
      $("#oldaddressStart").html(iaddress+" -");
      $("#newaddressStart").attr("value",iaddress);
      $("#editaddresslinkStart").text("edit start address");
    }
    else
    {
      $("#oldaddressStart").html();
      $("#editaddresslinkStart").text("add start address");
    }  

    if(faddress!="")
    {  
      $("#oldaddressEnd").html(faddress+" -");
      $("#newaddressEnd").attr("value",faddress);
      $("#editaddresslinkEnd").text("edit end address");
    }
    else
    {
      $("#oldaddressEnd").html(faddress);
      $("#editaddresslinkEnd").text("add end address");
    }
    var title=$("#"+id+"trip_title_less").html(); 
    $("#titledirection").html(removeHTMLTags(title.substr(1,title.length)));
    $(".sendnewDirectionaddress").attr("id",id);
    if(iaddress==""||faddress=="")
      directionpopup();
    else 
      dir_initialize(id,iaddress,faddress);
  }
  else
  {
    var id=type.replace("child","");
    $("#less"+id).css("display","none");
    $("#full"+id).css("display","block");
    $("#down"+id).css("display","none");
    $("#right"+id).css("display","block");
    $("#parent"+id).css("display","none");
    $("#print"+id).css("display","none");
  
    $("#"+id+"trip_title").show();
    $("#"+id+"trip_title_less").hide();
    $("#navcontainerdiv"+id).css("display","none");
  }
    this.showhide(divids, "show");
  }
},

showrestaurentmap:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {
    $(".hidemap").show();
    $(".showmap").hide();
    this.showhide(divids, "show");
    setTimeout(function(){initializerestaurent()},500);
  }
},
hiderestaurentmap:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {
    $(".hidemap").hide();
    $(".showmap").show();
    this.showhide(divids, "hide");
  }
},

showhotelmap:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {
    $(".hidemap").show();
    $(".showmap").hide();
    this.showhide(divids, "show");
    setTimeout(function(){initialize_map_global("mapglobal");},500);
  }
},
hidehotelmap:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {
    $(".hidemap").hide();
    $(".showmap").show();
    markerSet=0;
    check(item);
    this.showhide(divids, "hide");
  }
},

showtripdetailmap:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {
  var type=divids;
  if(type.indexOf("parent")!=-1)
  {
    var id=type.replace("parent","");
    
    $("#less"+id).css("display","block");
    $("#full"+id).css("display","none");
    //$("#child"+id).css("display","none");
    $("#parent"+id).css("display","block");
    $("#child"+id).css("display","none");
    $("#print"+id).css("display","block");
    $("#navcontainer"+id).css("display","block");
    var address=$("#"+id+"mapadd").html();
    address=address.replace("<b>Address:</b>&nbsp;","");
    address=address.replace("<B>Address:</B>&nbsp;","");//for IE
    address=address.replace("<b>Pick-up Address:</b>&nbsp;","");//for car
    address=address.replace("<B>Pick-up Address:</B>&nbsp;","");//for IE
    var title=$("#"+id+"trip_title").html();
    title=title.replace(". ","");
    $("#"+id+"trip_title").hide();
    $("#"+id+"trip_title_less").show();

    this.showhide("navcontainerdiv"+id, "show");
    if(address!="")
    {
      $("#oldaddress").html(address+" -");
      $("#newaddress").attr("value",address);
      $("#pridestore").show();
      $("#editaddresslink").text("edit address");
    }   
    else
    {  
      $("#oldaddress").html();
      $("#pridestore").hide();
      $("#editaddresslink").text("add address");
    }
    title=removeHTMLTags(title); 
    $("#titlediv").html(title); 
    setTimeout(function(){initialize(id+"map"); showAddress(address,title,id);},500);
  }
  else
  {
    var id=type.replace("child","");
    $("#less"+id).css("display","none");
    $("#full"+id).css("display","block");

    $("#navcontainer"+id).css("display","none");
    $("#child"+id).css("display","block");
    $("#parent"+id).css("display","none");
    $("#"+id+"trip_title").show();
    $("#"+id+"trip_title_less").hide();

    this.showhide("navcontainerdiv"+id, "hide");
  }
    this.showhide(divids, "show");
  }
},

showtripdetail:function(divids){ //public method
  if (typeof divids=="object")
  {
    var type=divids[0];
    // $("#"+type).css("background-color","#FBFAF7");
    var id=type.replace("parent","");
    $("#right"+id).css("display","none");
    $("#less"+id).css("display","block");
    $("#full"+id).css("display","none");
    $("#down"+id).css("display","block");
    $("#child"+id).css("display","none");
    $("#print"+id).css("display","block");
    $("#navcontainer"+id).css("display","block");
    $(".leftpadding").css("padding-left","22px");//hotel innerdiv
    $(".innerdivtriphotel").css("margin","0px");
    $("#detail"+id).css("padding-top","10px");
    // $(".innerdivtriphotel").css("background-color","#FBFAF7");

    $("#"+id+"trip_title").hide();
    $("#"+id+"trip_title_less").show();
    var obj=this;
    this.showhide(divids[0], "show");
    setTimeout(function(){obj.showhide("detail"+id, "show");},100);
  }
  else
  {
  var type=divids;
  // $("#"+type).css("background-color","#FBFAF7");
  if(type.indexOf("parent")!=-1)
  {
    var id=type.replace("parent","");
    $("#right"+id).css("display","none");
    $("#less"+id).css("display","block");
    $("#full"+id).css("display","none");
    $("#down"+id).css("display","block");
    $("#child"+id).css("display","none");
    $("#print"+id).css("display","block");
    $("#navcontainer"+id).css("display","block");
    $(".bordertop").css("border-top","2px dotted #E2E2DF");
    $(".innerdivtrip").css("background-color","#fff");
    $("#detail"+id).css("padding-top","10px");
    
    $("#innerimage"+id).css("display","block");//car innerdiv
    $(".carsearchinnerdiv").css("border-bottom","0px dotted #E2E2DF");
    $(".carinnerdetaildiv").css("padding-left","75px");
    $(".carrental").css("margin-left","10px");
    $(".padding50left").css("padding-left","0px");//removeClass("padding50left");
    
    $("#"+id+"trip_title").hide();
    $("#"+id+"trip_title_less").show();
    var obj=this;
    this.showhide(divids, "show");
    //this.showhide("detail"+id, "show");
    setTimeout(function(){obj.showhide("detail"+id, "show");},100);
  }
  else
  {
    var id=type.replace("child","");
    $("#down"+id).css("display","none");
    $("#full"+id).css("display","block");
    $("#less"+id).css("display","none");
    $("#right"+id).css("display","block");
    $("#parent"+id).css("display","none");
    $("#print"+id).css("display","none");
    $("#navcontainer"+id).css("display","none");
    $("#detail"+id).css("display","none");

    $("#"+id+"trip_title").show();
    $("#"+id+"trip_title_less").hide();
    this.showhide(divids, "show");
  }
  }
},
showdetail:function(divids){ //public method
  if (typeof divids=="object"){
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "show")
  }
  else
  {
    $('#more').css('display','none');
    $('#less').css('display','block');
    this.showhide(divids, "show");
  }
},
hidedetail:function(divids){ //public method
   if (typeof divids=="object"){
      this.showhide(divids[0], "hide")
  }
  else
  {
    $('#more').css('display','block');
    $('#less').css('display','none');
this.showhide(divids, "hide");
  }
  
},
readall:function(divids){ //public method
    if (typeof divids=="object"){
      this.showhide(divids[0], "show")
  }
  else
  {
    var h_divid="#"+divids+"1";
    $(h_divid).css('display','none');
    this.showhide(divids, "show");

  }
},
showdivrestaurent:function(divids){ //public method
    if (typeof divids=="object"){
      var id=divids[0];
      id=id.replace("inner",'');
      //animatedcollapse.hideadddiv([id+"addtrip",divids[1]]);
     animatedcollapse.hideemaildiv([id+"email_itdiv",divids[1]]);
     var scroll="#"+id; 
     $("#image"+id).hide();
     $("#note"+id).hide();
     var pos = $(scroll).offset();
      var inner="innerdiv"+id;
      var full_detail=".faf"+id;
      var less_detail=".fal"+id;
      var h_divid="#ld"+id;
      var s_divid="#fd"+id;
      var address=$("#localaddress"+id).html();
      var title=$("#titleaddress"+id).val();
      var lat=$("#lat"+id).val();
      var lan=$("#lan"+id).val();
      var mapid=id;
      $("#footerlink"+id).css("margin-top","-5px");
      $(s_divid).css('display','block');
      if(divids[1]=="nonfavorit")
      {
        full_detail=".nfaf"+id;
        less_detail=".nfal"+id;
        id="#"+id;
        //$(id).css('background-color','#ECF4FB');
        $(id).css('background-color','#ECF4FB');
      }
      $(less_detail).css('display','block');
      $(full_detail).css('display','none');
      this.showhide(divids[0], "show")
      setTimeout(function(){initializerestaurentinner(lan,lat,title,address,mapid)},500);
  }
  else
  {
    this.showhide(divids, "show");
  }
},
hidedivrestaurent:function(divids){ //public method
   if (typeof divids=="object"){
      var inner=divids[0];
      inner=inner.replace("inner",'');
     $("#image"+inner).show();
     $("#note"+inner).show();
      var full_detail=".faf"+inner;
      var less_detail=".fal"+inner;
      var h_divid="#fd"+inner;
      var s_divid="#ld"+inner;
      $(h_divid).css('display','none');
      //$(s_divid).css('display','block');
        var full_detail=".faf"+inner;
        var less_detail=".fal"+inner;
      $("#footerlink"+inner).css("margin-top","-16px");
      if(divids[1]=="nonfavorit")
      {
        var full_detail=".nfaf"+inner;
        var less_detail=".nfal"+inner;
        inner="#"+inner;
        $(inner).css('background-color','#ffffff');
    
      }
      if(divids[3]=="trip")
      {
        inner="#"+inner;
        $(inner).css('background-color','#fff');
      } 

      $(less_detail).css('display','none');
      $(full_detail).css('display','block');
      this.showhide(divids[0], "hide")
  }
  else
  {
    this.showhide(divids, "hide");
  }
  
},

showdivhotel:function(divids){ //public method
    if (typeof divids=="object"){
      var id=divids[0];
      id=id.replace("inner",'');
     var scroll="#"+id; 
      var pos = $(scroll).offset();
      var inner="innerdiv"+id;
      var full_detail=".faf"+id;
      var less_detail=".fal"+id;
      var h_divid="#ld"+id;
      var s_divid="#fd"+id;
      $("#imgshow_"+id).hide();
      $("#allprice"+id).hide();
      $(".hide_"+id).show();
      $("#bottomlink"+id).hide();
      $('#container'+id).triggerTab(1)
      roomdiv=id;
       
      //$(h_divid).css('display','none');
      $(s_divid).css('display','block');
      if(divids[1]=="nonfavorit")
      {
        full_detail=".nfaf"+id;
        less_detail=".nfal"+id;
        id="#"+id;
        //$(id).css('background-color','#ECF4FB');
        $(id).css('background-color','#ECF4FB');
      }
      if(divids[3]=="trip")
      {
        id="#"+id;
        $(id).css('background-color','#ECF4FB');
      } 
      $(less_detail).css('display','block');
      $(full_detail).css('display','none');
      if(divids[2]==0)
      {  
      window.scrollTo(0,pos.top);
      check(item);
      }
      this.showhide(divids[0], "show");
      if($("#roomHiddenAjax"+roomdiv).val()==0&&divids[1]!='favorit')  //rooms rab ajax
      {
        var htlId=roomdiv;
        roomImageloader(roomdiv);
        if(divids[1]=="available")
          htlId=htlId.replace("ava","");
        else
          if(divids[1]=="notavailable")
            htlId=htlId.replace("nva","");

        $("#roomsdivhotel"+roomdiv).load(local+"/hotel/htldetail", {'id':htlId}, function(){
            small_imageuloader();
            $(".stbuttontext").css('line-height','10px');
            $(".stbuttontext").addClass('tripsplanlink');
            $(".stico_default").css('display','block');
            $(".addtotriplink").click(function(){//for add to trip  without login
            tb_show("","#TB_inline?height=275&amp;width=492&amp;inlineId=popupflight&modal=true", "false");               
            tb_init('a.thickbox'); 
            return false;
        });
        $(".loginredirect").click(function() {  
        top.location.href =local+"/flight/favorite?favid="+this.id+"&page=2&act=0&sid="+sid;
        return false;
        });
        $("#roomHiddenAjax"+roomdiv).attr("value",1);
        $(".addfavorits").unbind('click',addtowatchlist);// add to watchlist
        $(".addfavorits").bind('click',addtowatchlist);
       });
      }
  }
  else
  {
    this.showhide(divids, "show");
  }
},
hidedivhotel:function(divids){ //public method
   if (typeof divids=="object"){
      var inner=divids[0];
      inner=inner.replace("inner",'');
      var full_detail=".faf"+inner;
      var less_detail=".fal"+inner;
      var h_divid="#fd"+inner;
      var s_divid="#ld"+inner;
      $(h_divid).css('display','none');
      $("#bottomlink"+inner).show();
      var full_detail=".faf"+inner;
      var less_detail=".fal"+inner;
      $("#imgshow_"+inner).show();
      $("#allprice"+inner).show();
      $(".hide_"+inner).hide();
      if(divids[1]=="nonfavorit")
      {
        var full_detail=".nfaf"+inner;
        var less_detail=".nfal"+inner;
        inner="#"+inner;
        $(inner).css('background-color','#ffffff');
    
      }
      if(divids[3]=="trip")
      {
        inner="#"+inner;
        $(inner).css('background-color','#fff');
      } 

      $(less_detail).css('display','none');
      $(full_detail).css('display','block');
      this.showhide(divids[0], "hide")
  }
  else
  {
    this.showhide(divids, "hide");
  }
  
},
hidecreatenew:function(divids){ //public method
    if (typeof divids=="object"){

      this.showhide(divids[0], "hide");
  }
  else
  {
    var id=divids;
    id=id.replace("crearenew","");
    $("#addbutton"+id).show();
    $(".triperrmsgText").html("");  
    $("#addtriptopdiv").show();
    $("#createbutton"+id).hide();
    if(page>=5)
    {
        daterange($("#triptype").val());
        if(page>5)
        {
          $("#restricting1_mytripsStart").attr("value","");
          $("#restricting1_mytripsEnd").attr("value","");
        } 
    }  
    this.showhide(divids, "hide");
  }
},

showcreatenew:function(divids){ //public method
    if (typeof divids=="object"){
      this.showhide(divids[0], "show");
  }
  else
  {
    var id=divids;
    id=id.replace("crearenew","");
    $("#addbutton"+id).hide();
    $("#addtriptopdiv").hide();
    $("#createbutton"+id).show();
    trip_fdate=3600;
    trip_idate=0;
    $(".triperrmsgText").html("");  
    if(page>5)
    {
      $("#restricting1_mytripsStart").attr("value","");
      $("#restricting1_mytripsEnd").attr("value","");
      trip_idateEnd=0;
    } 
    this.showhide(divids, "show");
  }
},

showparticipant:function(divids){ //public method
    if (typeof divids=="object"){
      var id=divids[0];
      var link="#"+id.replace("participant","participantlink");
      $(link).css("color","#666666");
      if(divids[1]=="nonfavorit")
      {
        id="#"+id;
        $(id).css('background-color','#ECF4FB');
      }
      this.showhide(divids[0], "show")
  }
  else
  {
    
    this.showhide(divids, "show");
  }
},
hideparticipant:function(divids){ //public method
   if (typeof divids=="object"){
      this.showhide(divids[0], "hide")
  }
  else
  {
    var id=divids;
     var link="#"+id.replace("participant","participantlink");
    $(link).css("color","#1C83CE")
    this.showhide(divids, "hide");
  }
  
},
hideemaildivmain:function(divids){ //public method
   if (typeof divids=="object"){
      var inner=divids[0];
      inner=inner.replace("email_itdiv_",'');
      if(divids[1]=="nonfavorit")
      {
        inner="#"+inner;
        if(page==7)
        {  
          inner=divids[0];
          inner=inner.replace("email_itdiv_",'');
          inner="#main_"+inner;
        }  
        $(inner).css('background-Color','#ffffff');
    
      }
      this.showhide(divids[0], "hide")
  }
  else
  {
    this.showhide(divids, "hide");
  }
  
},

showemaildivtripmain:function(divids){ //public method
    if (typeof divids=="object"){
    var type;
    var trip;
    if(divids[1]=="nonfavorit")
        type=0;
    else
      type=1;
    if(divids[2]!="uid")
        trip=divids[2];
    else
        trip=id;
    var id=divids[0];
    id=id.replace("email_itdiv_","");
    if($("#mytripmapdiv").css("display")=="block")
    animatedcollapse.hidetripmap("mytripmapdiv");
    var divid="#"+divids[0];
    $(divid).html("");
    $(divid).load(local+"/mytrips/emailbox",{'id':id,'fav':type,'tripid':id,'tripType':1} , function(){
         id="#main_"+id;
         $(divid).css('background-color','#FBFAF7');
         $(id).css('background-color','#FBFAF7');
         $(".addtotrip").css("margin-left","0px");
         $(".addtotrip").css("margin-right","9px");
    });
    this.showhide(divids[0], "show");
  }
  else
  {
    this.showhide(divids, "show");
  }
},

showemaildivtrip:function(divids){ //public method
    if (typeof divids=="object"){
    var type;
    var trip;
    if(divids[1]=="nonfavorit")
        type=0;
    else
      type=1;
    if(divids[2]!="uid")
        trip=divids[2];
    else
    {  
        trip=id;
    }    
    var id=divids[0];
    id=id.replace("email_itdiv","");
    if(divids[1]=="nonfavorit")
    {  
      if($("#"+id+"mapl").css("display")=="block")
      animatedcollapse.hidetripbottommap(id+"mapl");
    }  
    var divid="#"+divids[0];
    $(divid).html("");
    $(divid).load(local+"/mytrips/emailbox",{'id':id,'fav':type,'tripid':trip} , function(){
         id="#main_"+id;
         $(id).css('background-color','#ecf4fb');
         $(".addtotrip").css("margin-left","0px");
         $(".addtotrip").css("margin-right","0px");
    });
    this.showhide(divids[0], "show");
  }
  else
  {
    this.showhide(divids, "show");
  }
},
showemaildiv:function(divids,url){ //public method
  if (url==undefined) url='';
  
  if (typeof divids=="object"){
      var id=divids[0];
    id=id.replace("email_itdiv","");;
    
    var type;
    switch(divids[1])
    {
      case "nonfavorit" :
        type=0;
      break;     
      case "nonfavorit" :
        type=1;
      break;
      case "available" :
        type=2;
      break;     
        
    } 
   if(page>11)
    $("#addtotripmaindiv").css('width','474px');
    if(isFake=="1")   //fake trip
      sendinfoTripid="";

    id=id.replace("ava","");          //check fare list found
    var height=$("#outerdiv").height()+60;
    $("#loadimageaddtotrip").show();
    $("#addtotripdiv").hide();  
    var width=$("#outerdiv").width();
    height=$(document).height();
    width=$(document).width();
    $("#addtotripbg").css("width",width);
    $("#addtotripbg").css("height",height);
    $("#addtotripbg").css("opacity","0");
    $("#addtotripbg").css("display","block");
    
    var divheight=$("#addtotripmaindiv").height();
    var divtop=($(window).height()-$("#addtotripmaindiv").height())/2;
    $("#addtotripmaindiv").css("top",divtop+"px");

    $("#addtotripbg").animate({ 
    opacity: 0.5},500,function(){ $("#addtotripbg").show();$("#addtotripmaindiv").show();});

    $("#addtotripdiv").load(local+"/mytrips/emailbox",{'id':id,'fav':type,'sendinfoTripid':sendinfoTripid,'page':page,'url':url} , 
             function(){
                    id="#"+id;
                    small_imageuloader();
                    $("#loadimageaddtotrip").hide();
                    $("#addtotripdiv").show();
                    
                    var divheight=$("#addtotripmaindiv").height();
                    var divtop=($(window).height()-$("#addtotripmaindiv").height())/2;
                    $("#addtotripmaindiv").css("top",divtop+"px");
                 });

  }
  else
  {
    this.showhide(divids, "show");
  }
},
hideemaildiv:function(divids){ //public method
   if (typeof divids=="object"){
     $("#addtotripmaindiv").fadeOut("1000");
     $("#addtotripbg").css("display","none");
  }
  else
  {
    this.showhide(divids, "hide");
  }
  
},
showaddhoteldiv:function(divids){ //public method
    
    if (typeof divids=="object"){
    var type
    if(divids[1]=="nonfavorit")
        type=0;
    else
      type=1;
      id=divids[2]
   
      $("#loadimageaddtotrip").show();
      $("#addtotripdiv").hide();  

      $("#addtotripbg").css("width",$(document).width());
      $("#addtotripbg").css("height",$(document).height());
      $("#addtotripbg").fadeIn(400,function(){
             if (navigator.appName == "Microsoft Internet Explorer")
                this.style.removeAttribute("filter");
              $("#addtotripmaindiv").show();
           });

      $("#addtotripdiv").load(local+"/mytrips/showtripbox", { 'typeid':id,'type':type,'page':page } , 
             function(){
                    id="#"+id;
                    small_imageuloader();
                    $("#loadimageaddtotrip").hide();
                    $("#addtotripdiv").show();

                 });

  }
  else
  {
    this.showhide(divids, "show");
  }
},

showemaildivhotel:function(divids){ //public method
    
    if (typeof divids=="object"){
      id=divids[0];
      id=id.replace("email_itdiv",'');
      var height=$("#outerdiv").height()+60;
      $("#loadimageemailInfo").show();
      $("#emailInfodiv").hide();  
      
      $("#emailInfobg").css("width",$(document).width());
      $("#emailInfobg").css("height",$(document).height());
      $("#emailInfobg").css("opacity","0");
      $("#emailInfobg").css("display","block");
      $("#emailInfobg").animate({ 
               opacity: 0.5},500,function(){ 
                $("#emailInfomaindiv").show();
                var divheight=$("#emailInfomaindiv").height();
                var divtop=($(window).height()-$("#emailInfomaindiv").height())/2;
                $("#emailInfomaindiv").css("top",divtop+"px");
               });


      if(isFake=="1")   //fake trip
        sendinfoTripid="";
      var divid="#"+divids[0];
      $(divid).html("");
      var type;
      switch(divids[1])
      {
      case "nonfavorit" :
        type=0;
      break;     
      case "favorit" :
        type=1;
      break;
      case "available" :
        type=2;
        $("#"+divids[0]).css("margin-right","12px");
      break;     
        
    } 

      $("#emailInfodiv").load(local+"/mytrips/emailbox",{'id':id,'fav':type,'type':1,'sendinfoTripid':sendinfoTripid,'page':page} , function(){
             $("#loadimageemailInfo").hide();
             $("#emailInfodiv").show();
             var divheight=$("#emailInfomaindiv").height();
             var divtop=($(window).height()-$("#emailInfomaindiv").height())/2;
             $("#emailInfomaindiv").css("top",divtop+"px");
      });
  }
  else
  {
    this.showhide(divids, "show");
  }
},
hideemaildivhotel:function(divids){ //public method
             $("#emailInfomaindiv").fadeOut("1000");
             $("#emailInfobg").css("display","none");
},

showaddroomdiv:function(divids){ //public method
    
    if (typeof divids=="object"){
      var id=divids[0];
      if(divids[2])
         window.open("/hotel/book?url="+URLEncode(divids[2])+"&agency="+divids[3]);
      var type=0;
      id=id.replace("addtrip","");
   
      var height=$("#outerdiv").height()+60;
      $("#loadimageaddtotrip").show();
      $("#addtotripdiv").hide();  
      var width=$("#outerdiv").width();
      height=$(document).height();
      width=$(document).width();
      $("#addtotripbg").css("width",width);
      $("#addtotripbg").css("height",height);
      $("#addtotripbg").css("opacity","0");
      $("#addtotripbg").css("display","block");
      $("#addtotripbg").animate({ 
        opacity: 0.5},500,function(){ $("#addtotripbg").show();$("#addtotripmaindiv").show();});
      
      $("#addtotripdiv").load(local+"/mytrips/showtripbox", { 'typeid':id,'type':type,'page':page } , 
             function(){
                    id="#"+id;
                    small_imageuloader();
                    $("#loadimageaddtotrip").hide();
                    $("#addtotripdiv").show();

                 });
   
       //this.showhide(divids[0], "show");
  }
  else
  {
    this.showhide(divids, "show");
  }
},

showadddiv:function(divids){ //public method
    
    if (typeof divids=="object"){
      var id=divids[0];
    if(page==2)  
      if(item) 
        check(item);  //hide map popup
    if(divids[2])
      if(page==2)
        window.open("/hotel/book?url="+URLEncode(divids[2])+"&agency="+divids[3]);
      else
        window.open(divids[2]);
         
    var type=1;
    if(divids[1]=="nonfavorit")
        type=0;
      
   if(page>11)
    $("#addtotripmaindiv").css('width','484px');
    id=id.replace("addtrip","");
    id=id.replace("ava","");          //check fare list found
    $("#loadimageaddtotrip").show();
    $("#addtotripdiv").hide();  
    height=$(document).height();
    width=$(document).width();
    $("#addtotripbg").css("width",width);
    $("#addtotripbg").css("height",height);
    $("#addtotripbg").css("opacity","0");
    $("#addtotripbg").css("display","block");
    $("#addtotripbg").animate({ 
    opacity: 0.5},500,function(){ $("#addtotripbg").show();$("#addtotripmaindiv").show();});

    var divheight=$("#addtotripmaindiv").height();
    var divtop=($(window).height()-$("#addtotripmaindiv").height())/2;
    $("#addtotripmaindiv").css("top",divtop+"px");
    
    $("#addtotripdiv").load(local+"/mytrips/showtripbox", { 'typeid':id,'type':type,'page':page } , 
             function(){
                    id="#"+id;
                    small_imageuloader();
                    $("#loadimageaddtotrip").hide();
                    $("#addtotripdiv").show();

                    var divheight=$("#addtotripmaindiv").height();
                    var divtop=($(window).height()-$("#addtotripmaindiv").height())/2;
                    $("#addtotripmaindiv").css("top",divtop+"px");
                 });
       //this.showhide(divids[0], "show");
  }
  else
  {
    this.showhide(divids, "show");
  }
},
hideadddiv:function(divids){ //public method
   $("#addtotripmaindiv").fadeOut("1000");
   $("#addtotripbg").css("display","none");
},
 
 
showdiv:function(divids){ //public method
    if (typeof divids=="object"){
      var id=divids[0];
      id=id.replace("inner",'');
      animatedcollapse.hideadddiv([id+"addtrip",divids[1]]);
      animatedcollapse.hideemaildiv([id+"email_itdiv",divids[1]]);
      setTimeout(function(){
        if(id.indexOf("#")==-1)
          var divtop=$("#"+id).offset();
        else 
          var divtop=$(id).offset();

        window.scrollTo(0,divtop.top);      
               },300);

      var inner="innerdiv"+id;
      var full_detail="#faf"+id;
      var less_detail="#fal"+id;
      if(divids[1]=="nonfavorit")
      {
        full_detail="#nfaf"+id;
        less_detail="#nfal"+id;
        id="#"+id;
        $(id).css('background-color','#ECF4FB');
      }
      if(divids[2]=="trip")
      {
        id="#"+id;
        $(id).css('background-color','#ECF4FB');
      }  
      $(less_detail).css('display','block');
      $(full_detail).css('display','none');
      this.showhide(divids[0], "show")
  }
  else
  {
    this.showhide(divids, "show");
  }
},
hidediv:function(divids){ //public method
   if (typeof divids=="object"){
      var inner=divids[0];
      inner=inner.replace("inner",'');
      var full_detail="#faf"+inner;
      var less_detail="#fal"+inner;
      if(divids[1]=="nonfavorit")
      {
        var full_detail="#nfaf"+inner;
        var less_detail="#nfal"+inner;
        inner="#"+inner
        $(inner).css('background-color','#ffffff');
    
      }
      if(divids[2]=="trip")
      { 
        inner="#"+inner;
        $(inner).css('background-color','#ffffff');
      }  
      $(less_detail).css('display','none');
      $(full_detail).css('display','block');
      this.showhide(divids[0], "hide")
  }
  else
  {
    this.showhide(divids, "hide");
  }
  
},
hide:function(divids){ //public method
  if (typeof divids=="object"){
    var arrowname = '#'+divids[0]+'down';
    $(arrowname).css('display','none');
    arrowname = '#'+divids[0]+'right';
    $(arrowname).css('display','block');
    for (var i=0; i<divids.length; i++)
      this.showhide(divids[i], "hide")
  }
  else
  {
    if(divids.indexOf("d_tripplaninner")!=-1)
    {
      this.showhide(divids.replace("d_tripplaninner","daymapparent"), "hide");
    } 
    var arrowname = '#'+divids+'down';
    $(arrowname).css('display','none');
    arrowname = '#'+divids+'right';
    $(arrowname).css('display','block');
    this.showhide(divids, "hide");
  }
},

toggle:function(divid){ //public method
  this.showhide(divid, "toggle")
},

addDiv:function(divid, attrstring){ //public function
  this.divholders[divid]=({id: divid, $divref: null, attrs: attrstring})
  this.divholders[divid].getAttr=function(name){ //assign getAttr() function to each divholder object
    var attr=new RegExp(name+"=([^,]+)", "i") //get name/value config pair (ie: width=400px,)
    return (attr.test(this.attrs) && parseInt(RegExp.$1)!=0)? RegExp.$1 : null //return value portion (string), or 0 (false) if none found
  }
},

showhide:function(divid, action){
  var $divref=this.divholders[divid].$divref //reference collapsible DIV
  if (this.divholders[divid] && $divref.length==1){ //if DIV exists
    var targetgroup=this.divgroups[$divref.attr('groupname')] //find out which group DIV belongs to (if any)
    if ($divref.attr('groupname') && targetgroup.count>1 && (action=="show" || action=="toggle" && $divref.css('display')=='none')){ //If current DIV belongs to a group
      if (targetgroup.lastactivedivid && targetgroup.lastactivedivid!=divid) //if last active DIV is set
        this.slideengine(targetgroup.lastactivedivid, 'hide') //hide last active DIV within group first
        this.slideengine(divid, 'show')
      targetgroup.lastactivedivid=divid //remember last active DIV
    }
    else{
      this.slideengine(divid, action)
    }
  }
},

slideengine:function(divid, action){
  var $divref=this.divholders[divid].$divref
  if (this.divholders[divid] && $divref.length==1){ //if this DIV exists
    var animateSetting={height: action}
    if ($divref.attr('fade'))
      animateSetting.opacity=action
    $divref.animate(animateSetting, $divref.attr('speed')? parseInt($divref.attr('speed')) : 500)
    return false
  }
},

generatemap:function(){
  var map={}
  for (var i=0; i<arguments.length; i++){
    if (arguments[i][1]!=null){
      map[arguments[i][0]]=arguments[i][1]
    }
  }
  return map
},

init:function(){
  var ac=this
  jQuery(document).ready(function($){
    var persistopenids=ac.getCookie('acopendivids') //Get list of div ids that should be expanded due to persistence ('div1,div2,etc')
    var groupswithpersist=ac.getCookie('acgroupswithpersist') //Get list of group names that have 1 or more divs with "persist" attribute defined
    if (persistopenids!=null) //if cookie isn't null (is null if first time page loads, and cookie hasnt been set yet)
      persistopenids=(persistopenids=='nada')? [] : persistopenids.split(',') //if no divs are persisted, set to empty array, else, array of div ids
    groupswithpersist=(groupswithpersist==null || groupswithpersist=='nada')? [] : groupswithpersist.split(',') //Get list of groups with divs that are persisted
    jQuery.each(ac.divholders, function(){ //loop through each collapsible DIV object
      this.$divref=$('#'+this.id)
      if ((this.getAttr('persist') || jQuery.inArray(this.getAttr('group'), groupswithpersist)!=-1) && persistopenids!=null){
        var cssdisplay=(jQuery.inArray(this.id, persistopenids)!=-1)? 'block' : 'none'
      }
      else{
        var cssdisplay=this.getAttr('hide')? 'none' : null
      }
      this.$divref.css(ac.generatemap(['height', this.getAttr('height')], ['display', cssdisplay]))
      this.$divref.attr(ac.generatemap(['groupname', this.getAttr('group')], ['fade', this.getAttr('fade')], ['speed', this.getAttr('speed')]))
      if (this.getAttr('group')){ //if this DIV has the "group" attr defined
        var targetgroup=ac.divgroups[this.getAttr('group')] || (ac.divgroups[this.getAttr('group')]={}) //Get settings for this group, or if it no settings exist yet, create blank object to store them in
        targetgroup.count=(targetgroup.count||0)+1 //count # of DIVs within this group
        if (!targetgroup.lastactivedivid && this.$divref.css('display')!='none' || cssdisplay=="block") //if this DIV was open by default or should be open due to persistence                
          targetgroup.lastactivedivid=this.id //remember this DIV as the last "active" DIV (this DIV will be expanded)
        this.$divref.css({display:'none'}) //hide any DIV that's part of said group for now
      }
    }) //end divholders.each
    jQuery.each(ac.divgroups, function(){ //loop through each group
      if (this.lastactivedivid)
        ac.divholders[this.lastactivedivid].$divref.show() //and show last "active" DIV within each group (one that should be expanded)
    })
    var $allcontrols=$('*[rel]').filter('[@rel^="collapse-"], [@rel^="expand-"], [@rel^="toggle-"]') //get all elements on page with rel="collapse-", "expand-" and "toggle-"
    var controlidentifiers=/(collapse-)|(expand-)|(toggle-)/
    $allcontrols.each(function(){
      $(this).click(function(){
        var relattr=this.getAttribute('rel')
        var divid=relattr.replace(controlidentifiers, '')
        var doaction=(relattr.indexOf("collapse-")!=-1)? "hide" : (relattr.indexOf("expand-")!=-1)? "show" : "toggle"
        return ac.showhide(divid, doaction)
      }) //end control.click
    })// end control.each
    $(window).bind('unload', function(){
      ac.uninit()
    })
  }) //end doc.ready()
},

uninit:function(){
  var opendivids='', groupswithpersist=''
  jQuery.each(this.divholders, function(){
    if (this.$divref.css('display')!='none'){
      opendivids+=this.id+',' //store ids of DIVs that are expanded when page unloads: 'div1,div2,etc'
    }
    if (this.getAttr('group') && this.getAttr('persist'))
      groupswithpersist+=this.getAttr('group')+',' //store groups with which at least one DIV has persistance enabled: 'group1,group2,etc'
  })
  opendivids=(opendivids=='')? 'nada' : opendivids.replace(/,$/, '')
  groupswithpersist=(groupswithpersist=='')? 'nada' : groupswithpersist.replace(/,$/, '')
  this.setCookie('acopendivids', opendivids)
  this.setCookie('acgroupswithpersist', groupswithpersist)
},

getCookie:function(Name){ 
  var re=new RegExp(Name+"=[^;]*", "i"); //construct RE to search for target name/value pair
  if (document.cookie.match(re)) //if cookie found
    return document.cookie.match(re)[0].split("=")[1] //return its value
  return null
},

setCookie:function(name, value, days){
  if (typeof days!="undefined"){ //if set persistent cookie
    var expireDate = new Date()
    expireDate.setDate(expireDate.getDate()+days)
    document.cookie = name+"="+value+"; path=/; expires="+expireDate.toGMTString()
  }
  else //else if this is a session only cookie
    document.cookie = name+"="+value+"; path=/"
}

}


var directionsPanel;
var directions;
var map2;
var map_centre;
function  map_global_display(div_name,start_address,end_address,div2)
{

  var geocoder = new GClientGeocoder();
  geocoder.getLatLng(start_address,function (point) {
  if (!point) { alert("Sorry,address not found!");}
   else {
    map_centre=point;
    map2 = new GMap2(document.getElementById(div_name));
    map2.setCenter(map_centre,13);
    //map2.addControl(new GLargeMapControl());
    //map2.addControl(new GMapTypeControl());
     map2.setUIToDefault();
     map2.disableScrollWheelZoom();
    }
    });
    var  start_lat;
    var start_lng;
    var geocoder1 = new GClientGeocoder();
    geocoder1.getLatLng(start_address,function (point) {
    if (!point) { alert("Sorry,address not found!");}
    else {
           start_lat=point.lat();
           start_lng=point.lng();
         }
      }) ; 
    var geocoder2 = new GClientGeocoder();
    geocoder2.getLatLng(end_address,function (point) {
    if (!point ) { alert("Sorry,address not found!");}
     else {
        var end_lat=point.lat();
        var end_lng=point.lng();
        getDirections(div2,start_lat,start_lng,end_lat,end_lng);
           }
      });
}

    function getDirections(div2,start_lat,start_lng,end_lat,end_lng)
  {
    directionsPanel = document.getElementById(div2);
    directions = new GDirections(map2, directionsPanel);
    var query="from:"+start_lat+","+start_lng+"  to:"+end_lat+","+end_lng;
    alert(query);  
    directions.load(query);
    return;
  }

// Defining marker Array
 var MarkerArray=new Array();
 for(var i=0;i<5;i++)
 {
   MarkerArray[i]=new Array(2);
   MarkerArray[i][0]=22+ i;
   MarkerArray[i][1]=23+i;
 }

// Function to display day-wise trip on a map

 function mapping_day_wise_trip(mapContainer)
 {
  var map = new GMap2(document.getElementById(mapContainer));
  var MarkerLocArray = populateMarkers();
  var mapCenter =  MarkerLocArray[1];
  map.setCenter(mapCenter,7);
  map.setUIToDefault();
  map.disableScrollWheelZoom();
  var index = 0;
  var mapitem;
  for ( mapitem in MarkerLocArray)
  {
    var titleTag = "icon"+index;
    var loc = MarkerLocArray[index];
    map.addOverlay(createMarker(loc,titleTag,index+1));
    index++;
  }
}

function populateMarkers()
{
  var MarkerLocArray = new Array(); 
  var counter = 0;
  if(MarkerArray.length == 0)
  { return -1;}
  var position;
  for (position in  MarkerArray )
  {
    var x=MarkerArray[position][0];
    var y=MarkerArray[position][1];
    MarkerLocArray[counter]=new GLatLng(x,y);
    counter++;
  }
  alert(MarkerLocArray[2]);
  return MarkerLocArray;
}

function createMarker(loc,titleTag,index)
{
  var customIcon = new GIcon(G_DEFAULT_ICON);
  customIcon.image = local+"/images/map/blue_"+index+".png";
  customIcon.iconSize = new GSize(23,20);
  customIcon.iconAnchor = new GPoint(17,34);
  customIcon.shadow='';
  customIcon.infoWindowAnchor = new GPoint(17, 2);
  markerOptions={icon:customIcon,title:titleTag,clickable:true};        
  var marker=new GMarker(loc,markerOptions);
  return marker;
}    

/*single point marker */
var map = null;
var geocoder = null;

function initialize(div) {

  if (GBrowserIsCompatible()) {
     map = new GMap2(document.getElementById(div));
     map.setCenter(new GLatLng(37.4419, -122.1419), 13);
     map.setUIToDefault();
     map.disableScrollWheelZoom();
     geocoder = new GClientGeocoder();
  }
}

function showAddress(address,title,id) {
  if(geocoder) 
  {
     geocoder.getLatLng(
     address,
     function(point) 
     {
      if (!point) 
      {
        if(invite==0)
        {
          tb_show("","#TB_inline?height=280&amp;width=524&amp;inlineId=itemmappopup&modal=true", "false")
          $(".sendnewaddress").attr("id",id.replace("mapl","newaddress"));
        }
       else
        {
          $('#alertErrorText').text("Our Geolocator couldn't find this address.");
          errormsg("alertError");
        }  
       tb_init('a.thickbox');
       if(id.indexOf("mapl")!=-1)
         animatedcollapse.hidetripbottommap(id);
       else
        $("#"+id+"map").css("display","none");

      } 
      else 
      {
        map.setCenter(point, 13);
        var marker = new GMarker(point);
        var myicon=new GIcon(G_DEFAULT_ICON);
        myicon.image=local+"/images/mapinner.png";
        myicon.iconSize = new GSize(28,24);
        myicon.shadow='';
        myicon.iconAnchor = new GPoint(17,34);
        myicon.infoWindowAnchor = new GPoint(17, 2);
        markerOptions={icon:myicon,clickable:true};
        marker=new GMarker(point,markerOptions);
        map.addOverlay(marker);
        GEvent.addListener(marker,"click", function() {
        var myHtml="<div style='font-size:12px;color:black;'><b style='font-size:15px'>"+title+"<br/></b>"+address+"</div>";
        marker.openInfoWindowHtml(myHtml);});

      }
     }
    );
  }
}
/*direction */
var add1;
var add2;
var map;
var gdir;
var geocoder = null;
var addressMarker;
function dir_initialize(id,fromAddress, toAddress) {
     if (GBrowserIsCompatible()) {      
           map = new GMap2(document.getElementById("map_canvas"+id));
           $("#directions"+id).html("");
           gdir = new GDirections(map, document.getElementById("directions"+id));
           GEvent.addListener(gdir, "load", onGDirectionsLoad);
           GEvent.addListener(gdir, "error", handleErrors);
           map.setUIToDefault();
           map.disableScrollWheelZoom();
           geocoder = new GClientGeocoder();
           setDirections(fromAddress, toAddress,1);
      }
}
function setDirections(fromAddress, toAddress, type,locale) {
        geocoder = new GClientGeocoder();
        if(geocoder)
        {
          geocoder.getLatLng(fromAddress,
          function(point)
          {
            if(point)
            {
              geocoder.getLocations(point, 
              function(response)
              {
                fplace = response.Placemark[0];
                
                geocoder.getLatLng(toAddress,
                function(point)
                {
                  if(point)
                  {
                    geocoder.getLocations(point, 
                    function(response)
                    {
                      tplace = response.Placemark[0];
                      gdir.load("from: " +fplace.address + " to: " + tplace.address,
                                  { "locale": locale });

                    });
                  }
                  else
                  {
                    if(type==1)       //direction
                      directionpopup();    
                    else  
                      StartEnddirectionpopup();
                  }  
                    
                });

              });
            }
            else
            {
              if(type==1)       //direction
                directionpopup();  
              else 
                StartEnddirectionpopup(); 
            }
          });
        }  

                    }

function handleErrors(){
      if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
        directionpopup();
      else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
          directionpopup();
           else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
              directionpopup();  
                else if (gdir.getStatus().code == G_GEO_BAD_KEY)
                       directionpopup();
                    else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
                        directionpopup();  
                        else directionpopup();
}
function directionpopup()
{
  if(invite==0)
  {
    $("#map_canvas"+directionId).hide();
    $("#directions"+directionId).hide();
    tb_show("","#TB_inline?height=325&amp;width=524&amp;inlineId=itemdirectionpopup&modal=true", "false");
    tb_init('a.thickbox');
  }
  else
  {
    $('#alertErrorText').text("Our Geolocator couldn't find one or more of the addresses entered.");
    errormsg("alertError");
  }  

}
  function onGDirectionsLoad(){ 
                                  }





function initialize_multimarker_day(id,dayno) {
if (GBrowserIsCompatible()) {
    addressStr="";
    var map = new GMap2(document.getElementById("mytripidaymap"+id));
    geocoder = new GClientGeocoder();
    dayFlag=0;
    addressCounter=0;
    map.setCenter(new GLatLng(0,0),0);
    var bounds = new GLatLngBounds();
    map.setUIToDefault();
    map.disableScrollWheelZoom();
    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    var baseIcon = new GIcon(G_DEFAULT_ICON);
    //baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    baseIcon.iconSize = new GSize(20, 34);
    baseIcon.shadowSize = new GSize(37, 34);
    baseIcon.iconAnchor = new GPoint(9, 34);
    baseIcon.infoWindowAnchor = new GPoint(9, 2);
   // Creates a marker whose info window displays the letter corresponding
   // to the given index.
   function createMarker(point, index,address,title) {
    var customIcon = new GIcon(G_DEFAULT_ICON);
    customIcon.image = local+"/images/markers/"+index+".png";
    customIcon.iconSize = new GSize(23,20);
    customIcon.iconAnchor = new GPoint(17,34);
    customIcon.shadow='';
    customIcon.infoWindowAnchor = new GPoint(17, 2);
    markerOptions={icon:customIcon};        
    var marker=new GMarker(point,markerOptions);
    GEvent.addListener(marker, "click", function() {
               marker.openInfoWindowHtml("<div style='font-size:12px;color:black;'><b style='font-size:15px'>"+title+"<br/></b>"+address+"</div>");
     });
    return marker;
  }
// Add  markers to the map at random locations
function create_multi_marker(count)
{
if(geocoder)
    {
      geocoder.getLatLng(trp_address[count][0],
      function(point)
      {
         if (!point)
         {
           //alert(trp_address[count][0]+ " not found");
          if(trp_address[count][1]==dayno)
          {
           editaddress(addressCounter,count,"day");
           addressCounter++;
          }  
         }
         else
         {
            if(trp_address[count][1]==dayno)
            {
              bounds.extend(point);
              mytrips_g_day_map=1; 
              var trip_marker=parseInt(trp_address[count][1])+1;
              while(trip_marker>10)                   
                trip_marker=trip_marker-10;
              var marker_count=(trip_marker+"-"+(parseInt(trp_item[count])));
              map.addOverlay(createMarker(point, marker_count,trp_address[count][0],trip_title[count]));
           }  
         }
              count++;
              if(count<trp_address.length)
              {
                create_multi_marker(count);
              }
             else
             {
                if(mytrips_g_day_map==0)
                {
                    animatedcollapse.hidedaymap(['daymap'+id,id]);
                    if(dayFlag!=0)
                    { 
                      if(invite==0)
                      {
                        var height=235+(dayFlag*53);
                        $("#daymapaddress").html(addressStr);  
                        dayaddressbind();
                        tb_show("","#TB_inline?height="+height+"&amp;width=530&amp;inlineId=daymapaddresspopup&modal=true", "false");
                      }  
                      else
                      {
                        $('#alertErrorText').text("Our Geolocator couldn't find one or more of the addresses entered.");
                        errormsg("alertError");
                      }
                    }  
                    else  
                      tb_show("","#TB_inline?height=80&amp;width=245&amp;inlineId=map_alert_day&modal=true", "false");
                    tb_init('a.thickbox');
                }  
                map.setZoom(map.getBoundsZoomLevel(bounds));
                map.setCenter(bounds.getCenter()); 
             }
      } 
      );
    }
}
create_multi_marker(0);
}
}
function editaddress(addressCounter,count,type)
{
  var id=addressCounter;
  var addressType="Address";
  var title=trip_title[count];
  var displayType="";
  if(type!="day"&&$("#type_"+allItemId[id]).val()!="flight"&&$("#type_"+allItemId[id]).val()!="train"&&$("#type_"+allItemId[id]).val()!="car")
  {  
    dupid=count-1;
    while(dupid>=0)
    {  
      if(dupIdarray[dupid]==dupIdarray[count])
      {    
          displayType="displaynone";
          return;
      }
      dupid--;
    }
  }   
  if(displayType!="displaynone")
    dayFlag++;
  if(count!=0)
    if(allItemId[id]==allItemId[id-1])
    {  
        title="";
        addressType="End Address";
    } 
  if(allItemId[id]==allItemId[id+1])
    addressType="Start Address";  
  var address=trp_address[count][0];
  //addressAvailavel++;
  addressAvailavel=id;
  addressStr=addressStr+'<div class="clear '+displayType+'"><div class="colblack topmargin1 clear"><label class="mytripaitemheading">'+title+'</label></div><div class="margin5top"><div id="suggestiondiv'+id+'" class="overflowh"><div class="suggestion floatleft" id="oldaddress'+id+'">'+address+'</div><div class="floatleft">&nbsp;-&nbsp;&nbsp;<a href="" class="addaddresslink editallDayaddress" id="editaddresslink'+id+'">edit address</a></div></div><div class="displaynone ovewflowh" id="newaddressdiv'+id+'"><div class="colblack overflowh"><div class="floatleft width100">'+addressType+':&nbsp;</div><div class="floatleft"><input type="text" class="textbox1 width276 dayaddressField" id="newaddress'+id+'" value="'+getHTMLEncode(address)+'" name="dayadd['+id+']"/>&nbsp;&nbsp;<a href="" class="addaddresslink cancelallDayaddress" id="canceladdresslink'+id+'">cancel</a></div></div><div class="displaynone errmsgText clear" id="newaddresserror'+id+'">Please enter new address.</div><input type="hidden" id="hidden'+id+'" value="0"><input type="hidden" id="itemaddid'+id+'" value="'+allItemId[count]+'"></div></div></div>';

}

function initialize_multimarker(map_no_add) {
  
if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("mytripmap"));
    geocoder = new GClientGeocoder();
    dayFlag=0;
    addressStr="";
    map.setCenter(new GLatLng(0,0),0);
    var bounds = new GLatLngBounds();
     map.setUIToDefault();
     map.disableScrollWheelZoom();
    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    var baseIcon = new GIcon(G_DEFAULT_ICON);
    //baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    baseIcon.iconSize = new GSize(20, 34);
    baseIcon.shadowSize = new GSize(37, 34);
    baseIcon.iconAnchor = new GPoint(9, 34);
    baseIcon.infoWindowAnchor = new GPoint(9, 2);
    // Creates a marker whose info window displays the letter corresponding
   // to the given index.
   function createMarker(point, index,address,title) {
    var customIcon = new GIcon(G_DEFAULT_ICON);
    customIcon.image = local+"/images/markers/"+index+".png";
    customIcon.iconSize = new GSize(23,20);
    customIcon.iconAnchor = new GPoint(17,34);
    customIcon.shadow='';
    customIcon.infoWindowAnchor = new GPoint(17, 2);
    markerOptions={icon:customIcon};        
    var marker=new GMarker(point,markerOptions);
    GEvent.addListener(marker, "click", function() {
               marker.openInfoWindowHtml("<div style='font-size:12px;color:black;'><div style='font-size:15px'><b>"+title+"</b></div>"+address+"</div>");
     });
    return marker;
  }
// Add  markers to the map at random locations

function create_multi_marker(count)
{
if(geocoder)
    {
      geocoder.getLatLng(trp_address[count][0],
      function(point)
      {
         if (!point)
         {
           //alert(address + " not found");
           editaddress(count,count,"all");
         }
         else
         {
            bounds.extend(point);
            global_mytrips_map=1;       //flag for map display
             var trip_marker=parseInt(trp_address[count][1])+1;
             while(trip_marker>10)                   
                trip_marker=trip_marker-10;

              var marker_count=(trip_marker+"-"+(parseInt(trp_item[count])));
              map.addOverlay(createMarker(point, marker_count,trp_address[count][0],trip_title[count]));
         }
             count++;
             if(count<trp_address.length)
              {
                 while(trp_address[count][3]=="0")
                 {  
                   if(count==trp_address.length-1)
                   {  
                      if(global_mytrips_map==0)
                      {
                        animatedcollapse.hidetripmap('mytripmapdiv');
                        if(map_no_add==0)
                        {  
                          if(dayFlag!=0)
                          {
                            if(invite==0)
                            {  var height=235+(dayFlag*53);
                              $("#daymapaddress").html(addressStr);  
                              dayaddressbind();
                              tb_show("","#TB_inline?height="+height+"&amp;width=530&amp;inlineId=daymapaddresspopup&modal=true", "false");
                            }  
                            else
                            {
                              $('#alertErrorText').text("Our Geolocator couldn't find one or more of the addresses entered.");
                              errormsg("alertError");
                            }
                          }  
                          else  
                          {  
                            $('#alertErrorText').text("No address found in this trip.");
                            errormsg("alertError");
                          }  
                          tb_init('a.thickbox');
                        }  
                      } 
                      map.setZoom(map.getBoundsZoomLevel(bounds));
                      map.setCenter(bounds.getCenter()); 
                      break;
                   }
                   else
                   {   
                      count++;
                   }
                 } 
                 if(count<trp_address.length&&trp_address[count][3]=="1")
                 {
                      create_multi_marker(count);
              
                 }
                 else
                 {
                    if(global_mytrips_map==0)
                    {
                        animatedcollapse.hidetripmap('mytripmapdiv');
                        if(map_no_add==0)
                        {
                          if(dayFlag!=0)
                          { 
                            if(invite==0)
                            {   
                              var height=235+(dayFlag*53);
                              $("#daymapaddress").html(addressStr);  
                              dayaddressbind();
                              tb_show("","#TB_inline?height="+height+"&amp;width=530&amp;inlineId=daymapaddresspopup&modal=true", "false");
                            }  
                            else
                            {
                              $('#alertErrorText').text("Our Geolocator couldn't find one or more of the addresses entered.");
                              errormsg("alertError");
                            } 
                          }  
                          else  
                          { 
                            $('#alertErrorText').text("No address found in this trip.");
                            errormsg("alertError");
                          } 
                          tb_init('a.thickbox');
                        }  
                    } 
                    map.setZoom(map.getBoundsZoomLevel(bounds));
                    map.setCenter(bounds.getCenter()); 
                 }  
                  
              }     
             else
             {
                if(global_mytrips_map==0)
                {
                    animatedcollapse.hidetripmap('mytripmapdiv');
                    if(map_no_add==0)
                    {
                      if(dayFlag!=0)
                      {
                        if(invite==0)
                        {  
                          var height=235+(dayFlag*53);
                          $("#daymapaddress").html(addressStr);  
                          dayaddressbind();
                          tb_show("","#TB_inline?height="+height+"&amp;width=530&amp;inlineId=daymapaddresspopup&modal=true", "false");
                        }  
                        else
                        {
                          $('#alertErrorText').text("Our Geolocator couldn't find one or more of the addresses entered.");
                          errormsg("alertError");
                        }  
                      }  
                      else  
                      { 
                        $('#alertErrorText').text("No address found in this trip.");
                        errormsg("alertError");
                      } 
                      tb_init('a.thickbox');
                    }  
                } 
                map.setZoom(map.getBoundsZoomLevel(bounds));
                map.setCenter(bounds.getCenter()); 
             }
      });
    }
}
var marker_disp=0;
while(trp_address[marker_disp][3]=="0")
  if(marker_disp==trp_address.length-1)
    break;
  else  
    marker_disp++;
if(marker_disp<trp_address.length&&trp_address[marker_disp][3]=="1")
    create_multi_marker(marker_disp);
}
}

function dir_initialize_change(div,fromAddress, toAddress) {
     if (GBrowserIsCompatible()) {     
           StartEnd=div; 
           map = new GMap2(document.getElementById(div));
           gdir = new GDirections(map, document.getElementById(div.replace("mapldiv","directions")));
           GEvent.addListener(gdir, "load", onGDirectionsLoad);
           GEvent.addListener(gdir, "error", StartEndhandleErrors);
           map.setUIToDefault();
           map.disableScrollWheelZoom();
           geocoder = new GClientGeocoder();
           setDirections(fromAddress, toAddress,2);
           
      }
}
function StartEndhandleErrors(){
      if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
        StartEnddirectionpopup();
      else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
          StartEnddirectionpopup();
           else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
              StartEnddirectionpopup();  
                else if (gdir.getStatus().code == G_GEO_BAD_KEY)
                       StartEnddirectionpopup();
                    else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
                        StartEnddirectionpopup();  
                        else StartEnddirectionpopup();
}
function StartEnddirectionpopup()
{
  if(invite==0)
  {  
    animatedcollapse.hidetripbottommap(StartEnd.replace("div",""));
    tb_show("","#TB_inline?height=280&amp;width=524&amp;inlineId=itemStartEnddirectionpopup&modal=true", "false");
    tb_init('a.thickbox');
  }
  else
  {
    animatedcollapse.hidetripbottommap(StartEnd.replace("div",""));
    $('#alertErrorText').text("Our Geolocator couldn't find one or more of the addresses entered.");
    errormsg("alertError");
  }  
}

function map_check()
{
  $(".daycheck").click(function(){
                       for(count=0;count<trp_address.length;count++)
                       {
                        if(trp_address[count][1]==this.id)
                        {
                          if($(this).is(':checked'))
                          {
                            trp_address[count][3]='1';
                          }  
                          else
                          {
                            trp_address[count][3]='0';
                          }  
                        }  
                       }
                      initialize_multimarker(0);
                       })
}

function  small_imageloader(divid)
{

  var pos=$(divid.replace("addtrip","")).offset();
  pos=$(divid).offset();
  $("#loadimagepictire").css("left",pos.left+332);
  
  $("#loadimagepictire").css("top",pos.top+10);
  $("#loadimagepictire").css("display","block");
}
function  roomImageloader(divid)
{

  var pos=$("#"+divid).offset();
  window.scrollTo(0,pos.top-20);
  pos=$("#container"+divid).offset();
  $("#loadimagepictire").css("left",pos.left+350);
  $("#loadimagepictire").css("top",pos.top+30);
  $("#loadimagepictire").css("display","block");
}

function  small_imageuloader()
{
  $("#loadimagepictire").css("display","none");
}

        
function initializerestaurent() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("mapglobal"));
    geocoder = new GClientGeocoder();
    map.setUIToDefault();
    map.disableScrollWheelZoom();
    map.setCenter(new GLatLng(0,0),0);
    var bounds = new GLatLngBounds();
    var baseIcon = new GIcon(G_DEFAULT_ICON);
    baseIcon.shadow = "";//"http://www.google.com/mapfiles/shadow50.png";

    baseIcon.iconSize = new GSize(23, 20);
    baseIcon.iconAnchor = new GPoint(17, 34);
    baseIcon.infoWindowAnchor = new GPoint(17, 2);
    
    function createMarker(point, index,title,address) {
      bounds.extend(point);
      var letteredIcon = new GIcon(baseIcon);
      if(index!=-1)
      {  
        index++;
        letteredIcon.image = local+"/images/map/blue_"+index+".png";
      }
      else
      {
        letteredIcon.image =local+"/images/mapinner.png"; 
      }  
      markerOptions = { icon:letteredIcon };
      var marker = new GMarker(point, markerOptions);
      GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowHtml("<div style='font-size:12px;color:black;'><div style='font-size:15px'><b>"+title+"</b></div>"+address+"</div>");
      });
      return marker;
      }
    for (var i = 0; i <details.length; i++) {
      var latlng =new GLatLng(details[i][2],details[i][3]);
      map.addOverlay(createMarker(latlng, i,details[i][0],details[i][1]));

    }
    if (geocoder) 
    {
      geocoder.getLatLng(
      $("input[@name='location']:checked").val(),
      function(point) {
        if (!point) {
        } else {
          map.addOverlay(createMarker(point,-1,'',$("input[@name='location']:checked").val()));
          bounds.extend(point);
        }
          map.setZoom(map.getBoundsZoomLevel(bounds));
          map.setCenter(bounds.getCenter()); 
        }
      );
    }


    map.setZoom(map.getBoundsZoomLevel(bounds));
    map.setCenter(bounds.getCenter()); 
 }
}
function showtripday()
{
$(".dayexpand").click(function(){
   var year=this.id;
   var count=0;
   for(count=-1;count<idarray.length;count++)
   {
      if(idarray[count][0]==year)
      {
        year=idarray[count][1];
        var scroll="#m_tripplan"+year;
        var pos = $(scroll).offset();
        window.scrollTo(0,pos.top-50);
        var collapsed = $.cookie('collapsed');
        var collapsedArr = new Array();
        if(collapsed)
        {
          collapsedArr = collapsed.split(',');
          collapsedArr.splice(collapsedArr.indexOf(year), 1);
        }
        $.cookie('collapsed', collapsedArr, { path: '/', expires: 365 });
        animatedcollapse.show('d_tripplaninner'+year);
        $("#d_tripplaninner"+year+"down").css("display","block");
        $("#d_tripplaninner"+year+"right").css("display", "none");
        $("#tripday_h"+year+"down").css("display","block");
        $("#tripday_h"+year+"right").css("display", "none");

      }
    }
  return false;
});
}
function addtotripbooklink(url,Purl)
{
  //window.open(url);
      if(page==2)
        window.open("/hotel/book?url="+URLEncode(url)+"&agency="+Purl);
      else
        window.open(url);
   tb_show("","#TB_inline?height=275&amp;width=492&amp;inlineId=popupflight&modal=true", "false");    
   tb_init('a.thickbox'); 
   return false;
}

function daterange(tripid)
{
  var t_i_date=new Date(dateArray[tripid][0]);
  var date1=new Date(dateArray[tripid][1]);
  var myday = new Date(date1);
  var today=  new Date();  
  var one_day=1000*60*60*24;
  trip_fdate=Math.ceil((date1.getTime()-today.getTime())/(one_day));
  trip_idate=Math.ceil((t_i_date.getTime()-today.getTime())/(one_day));
  if(page>5)
    trip_idateEnd=trip_idate;
}
function removeHTMLTags(strInputCode){
 strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
 return (p1 == "lt")? "<" : ">";
 });
 var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
 return strTagStrippedText; 
}
function URLEncode(url)
{
    
    var SAFECHARS = "0123456789" +          
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +  
                          "abcdefghijklmnopqrstuvwxyz" +
                                    "-_.!~*'()";          
    var HEX = "0123456789ABCDEF";

    var plaintext = url;
    var encoded = "";
    for (var i = 0; i < plaintext.length; i++ ) {
      var ch = plaintext.charAt(i);
      if (ch == " ") {
      encoded += "+";       
      } else if (SAFECHARS.indexOf(ch) != -1) {
      encoded += ch;
      } else {
      var charCode = ch.charCodeAt(0);
      if (charCode > 255) {
          encoded += "+";
      } else {
      encoded += "%";
      encoded += HEX.charAt((charCode >> 4) & 0xF);
      encoded += HEX.charAt(charCode & 0xF);
      }
      }
      } 
      return encoded;
};
function getHTMLEncode(t) {
      return t.toString().replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
}
function calendar_(id){
alert(id);
}
function searchInvite()
{
if(page!=2)
{  
    height=$(document).height();
    width=$(document).width();
    $("#addtotripbg").css("width",width);
    $("#addtotripbg").css("height",height);
    $("#addtotripbg").css("opacity","0");
    $("#addtotripbg").css("display","block");
    $("#addtotripbg").animate({ 
    opacity: 0.5},500,function(){ $("#addtotripbg").show();$("#addtotripmaindiv").show();});

    var divheight=$("#addtotripmaindiv").height();
    var divtop=($(window).height()-$("#addtotripmaindiv").height())/2;
    $("#addtotripmaindiv").css("top",divtop+"px");
    
    $("#addtotripdiv").load(local+"/mytrips/invite", { 'tripid':sendinfoTripid},function(){
                    $("#loadimageaddtotrip").hide();
                    $("#addtotripdiv").show();

                    var divheight=$("#addtotripmaindiv").height();
                    var divtop=($(window).height()-$("#addtotripmaindiv").height())/2;
                    $("#addtotripmaindiv").css("top",divtop+"px");
                }
    )
}      
else
{   
    $("#emailInfobg").css("width",$(document).width());
    $("#emailInfobg").css("height",$(document).height());
    $("#emailInfobg").css("opacity","0");
    $("#emailInfobg").css("display","block");
    $("#emailInfobg").animate({opacity: 0.5},500,function(){ 
       $("#emailInfomaindiv").show();
       var divheight=$("#emailInfomaindiv").height();
       var divtop=($(window).height()-$("#emailInfomaindiv").height())/2;
       $("#emailInfomaindiv").css("top",divtop+"px");
    });
    $("#emailInfodiv").load(local+"/mytrips/invite", { 'tripid':sendinfoTripid},function(){
       $("#loadimageemailInfo").hide();
       $("#emailInfodiv").show();
       var divheight=$("#emailInfomaindiv").height();
       var divtop=($(window).height()-$("#emailInfomaindiv").height())/2;
       $("#emailInfomaindiv").css("top",divtop+"px");
    });
}
}    
