/////////////////////////////////////////////////
//FUNCTIONS THAT WILL BE ASSIGN TO EVENTS 
/////////////////////////////////////////////////

function getSelected(opt) {
    var selected = new Array();
    var index = 0;
    for (var intLoop = 0; intLoop < opt.length; intLoop++) {
       if ((opt[intLoop].selected) ||
           (opt[intLoop].checked)) {
          index = selected.length;
          selected[index] = new Object;
          selected[index].value = opt[intLoop].value;
          selected[index].text = opt[intLoop].text;
          selected[index].index = intLoop;
       }
    }
    return selected;
}

function outputSelected(opt,type) {
    var sel = getSelected(opt);
    var strSel = "";
    
    for (var item in sel){
        if (type == 'value'){
            return sel[item].value
        }else{
            return sel[item].text
        }
    }
    
}


function comment_rating(rate,name,ratestate,ratestatevalue){
  
  document.getElementById(name).value = rate;
  document.getElementById('ratestatevalue').innerHTML = ratestatevalue;
  document.getElementById(ratestate).style.width = (rate*20)+'%';
}

//seteaza categoria la main category event search v2 
function set_main_search_category(o,id){

  document.getElementById('search_main_category').innerHTML = o.innerHTML
  document.getElementById('search_main_category_id').value = id
  document.getElementById('search_main_category_arrow').className = 'expand';
  document.getElementById('search_main_category').className = 'text';
  xmlSyncRequestTextFunction('index.php?ajx=1&id='+id+'&controller=Opt&ident=&m=subcat',0,'subcat');
}

//make tooltip for program tv on loading js 
function makeTool(){
  $('a.load-local').cluetip({local:true, cursor: 'pointer',positionBy:'fixed',leftOffset:-50,topOffset: 30 });
}

//seteaza categoria la secondary category event search v2
function set_main_search_category2(o,id){

  document.getElementById('search_main_category5').innerHTML = o.innerHTML
  document.getElementById('search_main_category_id5').value = id
  document.getElementById('search_main_category_arrow5').className = 'expand';
  document.getElementById('search_main_category5').className = 'text';
  xmlSyncRequestTextFunction('index.php?ajx=1&id='+id+'&controller=Opt&ident=6&m=subcat&type=locatie',0,'toggler611');
}

function set_sec_search_category(o,id){

  document.getElementById('search_sec_category').innerHTML = o.innerHTML
  document.getElementById('search_sec_category_id').value = id
  document.getElementById('search_sec_category_arrow').className = 'expand';
  document.getElementById('search_sec_category').className = 'text';
}


function set_sec_search_category61(o,id){

  document.getElementById('search_sec_category6').innerHTML = o.innerHTML
  document.getElementById('search_sec_category_id6').value = id
  document.getElementById('search_sec_category_arrow6').className = 'expand';
  document.getElementById('search_sec_category6').className = 'text';

}

function refresh_form_category($o){

  $f = $o.form;
  $f.c1 = document.getElementById("form_category[1]").value
  $f.c2 = document.getElementById("form_category[2]").value
  $f.c3 = document.getElementById("form_category[3]").value
  
  $f.onsubmit = null;
  $f.action = null;
  $f.submit(); 
}

function select_region_onmouseover(){

}

function select_region_onmouseout(){

}



function select_cinema_orar_onchange($t,$v){
  $str = new String($t);
  $loc = new String($l);
  location.href = '/program_cinema?orar='+$str+'&cinema='+$loc    
                  +'&day='+(querySt('day')==undefined?0:querySt('day'))
}

function querySt(ji) {
  hu = window.location.search.substring(1);
  gy = hu.split("&");
  for (i=0;i<gy.length;i++) {
    ft = gy[i].split("=");
    if (ft[0] == ji) {
    return ft[1];
    }
  }
}
 
function refresh_dates($o){
  $f = $o.form;
  $f.form_csdate.value = $f.form_sdate.value;
  $f.form_cedate.value = $f.form_edate.value;
  $f.onsubmit = null;
  $f.action = null;
  $f.submit()
    
}

function refresh($o){
  $f = $o.form;
  $f.onsubmit = null;
  $f.action = null;
  $f.submit();   
}

function form_type_change() {
  $t = document.getElementById('form_type');
  $f = $t.form;
  $f.onsubmit = '';
  $f.action = '';
  $f.submit()
}

function homepage_select_program_change() {
  $t = document.getElementById('homepage_select_program');
  location.href = '/post?id='+$t.value
} 

function programtv_select_select_start_h_change(){
  $t = document.getElementById('select_start_h');
  $str = new String($t.value)
  $arr = $str.split(":",2);
  location.href = '/program_tv?hour='+$arr[0]+'&day='+(querySt('day')==undefined?0:querySt('day'))
                  +'&sday='+($t.value==undefined?0:$t.value)

}
 
function admin_select_form_tvstation_change(){
  $t = document.getElementById('form_tvstation');
  $f = $t.form;
  $f.onsubmit = '';
  $f.action = '';
  $f.submit()
}

function admin_select_form_judetid_change(){
  $o = document.getElementById('form_judet_id');
  $f = $o.form;
  $f.onsubmit = null;
  $f.action = null;
  $f.submit()
}

function SaveSchedule_onclick_function($o){
  $f = $o.form;
  $f.set_redirect.value = 'publish';
  $f.onsubmit()
  
}

/////////////////////////////////////////////////
//OBJECT THAT MAKES THE SLIDER ON PROGRAM TV WORK!
/////////////////////////////////////////////////

function drag_id_onmouseover ($o,$b) {
  this.out = 0
  this.oin = document.getElementById(this.id);
  this.ooo = document.getElementById(this.dragidcont);
  this.obb = document.getElementById('maincontainer');
  
  
  this.ooo.parentNode.parentNode.parentNode.parentNode.parentNode.onselect = function (){
    return false;
  }

  this.getUrl = function (){
      xmlSyncRequestTextFunction('index.php?ajx=1&too='+this.too+'&cat='+this.cat+'&controller=Program&m=tv&day='+querySt('day'),0,this.program_table,makeTool);
  }

  //position algoritm 
  this.position = function (e){
    if (this.oin.move == true){
    
        if (!e)
        e = window.event;
             
        if (document.all){
          $to = e.clientX - (this.ooo.offsetLeft+(this.obb.offsetLeft+70))
        } else {
          $to = e.pageX - (this.ooo.offsetLeft+(this.obb.offsetLeft+70))
        }
      
      if ($to){  
        if ($to < 0 ){
            $to = 0;
            this.oin.style.left =  $to+'px';
        }else if ($to>538){
            $to = 538;
            this.oin.style.left =  $to+'px';
        }else{
            this.oin.style.left =  $to+'px';
        }
        this.too = $to;
        }
      }
      document.body.style.cursor = 'pointer';

  }  
  
  this.onreleaseout = function (){
    if (this.move == true )
    {
      document.mytarget = this
      if (document.all){
        document.onmouseup = function () { document.mytarget.onmouseup(); document.onmouseup = null; return true; };
      }else{
        document.captureEvents(Event.MOUSEUP);
        document.onmouseup = function () { document.mytarget.onmouseup(); document.onmouseup = null; return true; };
      }
    }
  }
  
  //onmousedown
  this.onmousedown = function (e){
    this.move = true
    this.onreleaseout();
    this.disable_selection(false);
    
  }
  
  //onmouseout
  this.onmouseout = function (e){
    this.out = 1
  }

  //disable selection 
  this.disable_selection = function (bool){
  
    document.selection_disabled = bool
    
    if (document.all){
      document.onselectstart = function () { return this.selection_disabled; };
    }else{
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = function () {  return this.selection_disabled; };
    }

  }  
  //onmouseup
  this.onmouseup = function (e){
    this.move = false
    this.position(e)
    this.disable_selection(true);
    this.getUrl()
  }
  
  //parentNode
  this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.oin = this.oin
  this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.onmousemove = function (e){
    this.oin.position(e);
  }

}

/////////////////////////////////////////////////
//v1 OBJECT THAT MAKES SORTING OF RESTAURANTE (CATEGORY) PAGE WORK  (POPULARITATE,PRET...ETC)
/////////////////////////////////////////////////
function restaurante (){
    this.onmouseout = function (){
      document.getElementById('restaurante_name' + '_div').style.display  = 'none';
      document.getElementById('restaurante_popularitate' + '_div').style.display  = 'none';
      
      if (document.getElementById('restaurante_pret'))
      document.getElementById('restaurante_pret' + '_div').style.display  = 'none';
      
      document.getElementById(this.id + '_div').style.display  = '';
    }
    this.onmouseover = function (){
      document.getElementById('restaurante_name' + '_div').style.display  = 'none';
      document.getElementById('restaurante_popularitate' + '_div').style.display  = 'none';
      
      if (document.getElementById('restaurante_pret'))
      document.getElementById('restaurante_pret' + '_div').style.display  = 'none';
      
      document.getElementById(this.id + '_div').style.display  = '';
    }
    this.onmouseover();
}

/////////////////////////////////////////////////
//ASSSIGN ON LOAD FUNCTION IN PAGES THAT DON'T HAVE JQUERY
///////////////////////////////////////////////// 
window.onload = function (){

    //form show haide events for add event form 
    function sh_select($button,$type,$func){
       if (document.getElementById($button)){    
            document.getElementById($button).style.display = 'none'    
            document.getElementById($button+'_button').onclick = function (){
                document.getElementById($button).style.display = document.getElementById($button).style.display == 'none'?'block':'none';
            }    
            document.getElementById($button+'_select').func = $func
            document.getElementById($button+'_select').onclick = function (){
                if ($type == 'value'){
                    document.getElementById($button+'_value').value  = outputSelected(this,$type)
                }else{
                    document.getElementById($button+'_text').value  = outputSelected(this,$type)
                    document.getElementById($button+'_value').value  = outputSelected(this,'value')
                }
                document.getElementById($button).style.display  = 'none';
                
    
                if (this.func != false && document.getElementById($button+'_value').value != 'undefined')
                {
                    xmlSyncRequestTextFunction('index.php?ajx=1&id='+document.getElementById($button+'_value').value+'&controller=Opt&m='+this.func+'&tpl=opt_subcat',0,'cat2');        
                }
                
            }
        }
    }
    
    sh_select('sdh',"value",false);
    sh_select('ssdh',"value",false);
    sh_select('edh',"value",false);
    sh_select('eedh',"value",false);
    
    sh_select('cat1',"name",'subcat');
    sh_select('cat2',"name",false);

    if (document.getElementById('town_name_button')){
        sh_select('town_name',"name");
    }
    
    //v2 front end menu 
    document.menus = new Array("menu_program","menu_evenimente","menu_loc","menu_pagina","menu_start");    
    document.ca = new Array();
    document.cas = new Array();
    for (var m=0;m<document.menus.length;m++){
      if (document.getElementById(document.menus[m])){
          document.ca[document.menus[m]] = null;
          document.cas[document.menus[m]] = 1
          
          var x = document.getElementById(document.menus[m]);
          var i = document.getElementById(document.menus[m]+'_sub');
          var v = document.getElementById(document.menus[m]+'_cont');
          var f = document.getElementById(document.menus[m]+'_first');

          
          i.v = document.getElementById(document.menus[m]+'_cont');
          i.mms = document.menus[m];
          i.what = document.menus[m];
          
          
          i.onmouseout = function (){
            document.cas[this.mm] = 0
          }
          
          i.onmouseover = function (){
            document.cas[this.what] = 1
            
            for (var m=0;m<document.menus.length;m++){
                if (this.mms != document.menus[m]){
                document.getElementById(document.menus[m]).className  = '';
                document.getElementById(document.menus[m]+"_cont").style.display  = 'none';
                }
            }
            if (!document.ca[this.what])
            document.ca[this.what] = window.setInterval("if (document.cas['"+this.what+"'] == 1 ) {document.cas['"+this.what+"'] = 0}else{  document.getElementById('"+this.what+"').className  = '';document.getElementById('"+this.what+"_cont').style.display  = 'none';}",1000);
            this.v.style.display  = 'block';
          }
          
          a = new Array();
          for(i=0;i<=12;i++){
              if (document.getElementById(document.menus[m]+'_m_'+i)){
                  a[i] = document.getElementById(document.menus[m]+'_m_'+i);
                  a[i].v = v;
                  a[i].mm = document.menus[m]
                  a[i].onmouseout = function (e){
                    if (this.id == this.mm+'_m_0'){
                    document.getElementById(this.mm+'_first').className = 'arrow'
                    }
                    document.cas[this.mm] = 0
                  }
                  a[i].onmouseover = function (){
                    if (this.id == this.mm+'_m_0'){
                    document.getElementById(this.mm+'_first').className = 'arrow_hover'
                    }
                    document.cas[this.mm] = 1

                  }
              }
          }
      }
    }

    //events atached on load for front end general interface
    if (document.getElementById('form_sdate_year')){
    document.tabView = new YAHOO.widget.TabView('demo');
    }
    
    if (document.getElementById('form_type')){
      document.getElementById('form_type').onchange = form_type_change;
    }

  
    if (document.getElementById('homepage_select_program')){
      document.getElementById('homepage_select_program').onchange = homepage_select_program_change;
    }

    if (document.getElementById('form_tvstation')){
      document.getElementById('form_tvstation').onchange = admin_select_form_tvstation_change;
      document.getElementById('form_phone').onchange = admin_select_form_tvstation_change;
    }
  
    if (document.getElementById('form_judet_id')){
      document.getElementById('form_judet_id').onchange = admin_select_form_judetid_change;
    }
    
    if (document.getElementById('select_start_h')){
      document.getElementById('select_start_h').onchange = programtv_select_select_start_h_change;
    }
    
    if (document.getElementById('select_cinema_orar')){
         document.getElementById('select_cinema_orar').onchange = select_cinema_orar_onchange;
         document.getElementById('select_cinema_locatie').onchange = select_cinema_orar_onchange;
    }
    
    if (document.getElementById('region_select')){
        document.getElementById('region_select').onmouseover = select_region_onmouseover
        document.getElementById('region_select').onmouseout = select_region_onmouseout
    }

    if (document.getElementById('restaurante_name')){
        if (document.getElementById('restaurante_pret'))    
        document.getElementById('restaurante_pret').onmouseover = restaurante
        
        document.getElementById('restaurante_popularitate').onmouseover = restaurante
        document.getElementById('restaurante_name').onmouseover = restaurante
    }
    
    if (document.getElementById('map')){
       var map = new YMap(document.getElementById('map'));
       map.addTypeControl();     
       map.addZoomLong();            
       map.addPanControl();    
       $lon = document.getElementById('maplon')?document.getElementById('maplon').value:0;
       $lat = document.getElementById('maplat')?document.getElementById('maplat').value:0;
       var currentGeoPoint = new YGeoPoint($lat,$lon);  
       map.addMarker(currentGeoPoint);           

       map.drawZoomAndCenter(currentGeoPoint, 3);
       map.setMapType(YAHOO_MAP_REG);  
    }
}
/////////////////////////////////////////////////    
//ASSIGN EVENTS IN PAGES THAT HAVE JQUERY
/////////////////////////////////////////////////
if (typeof $ == 'function'){
  $(document).ready(function() {
    //set interval for auto search location in add event form
    window.searchit_add = function ($id,$vname){
        document.getElementById('search_loc_id').value = $vname
        document.getElementById('search_loc_hid').value = $id
        document.getElementById('search_loc').style.display="none";
        window.old = undefined
    }
    window.searching = function (){
        $v = document.getElementById('search_loc_id').value
        if (window.old != $v && window.old != undefined ){
            xmlSyncRequestTextFunction('index.php?ajx=1&search='+$v+'&controller=Opt&m=subloc&rand='+Math.random(),0,'search_loc_ajx');
            document.getElementById('search_loc').style.display="block";
        }  
        window.old = $v 
    } 
    if (document.getElementById('search_loc_id')){
        window.setInterval("window.searching()",1000);
    }
    
    //hide that piker library stuff in bottom of the page
    window.hidecal = window.setInterval("if(document.getElementById('ui-datepicker-div')){document.getElementById('ui-datepicker-div').style.display ='none';}clearInterval(window.hidecal);",5000);
    
    if (document.getElementById("stab1") && document.getElementById("stab2")){
    //search tabs animation 
    $tabs = $("#tabs").tabs({
         select: function(event, ui) {
             $ts = $tabs.data('selected.tabs')
             if ($ts == 1){
             document.getElementById("stab1").className = 'tab1_sel';
             document.getElementById("stab2").className = 'tab2';
             }else{
             document.getElementById("stab2").className = 'tab2_sel';
             document.getElementById("stab1").className = 'tab1';
             }
         }
    });
    }
    
    if (querySt('v_specific') > 0 || querySt('v_gen') > 0  ){
        $tabs.tabs('select', 1);
        
    }
    
    //search combobox animation
    function set_combo(trigger_id,container_id,search_main_category_arrow,search_main_category)
    {
        if (document.getElementById(trigger_id)){
            $("."+trigger_id).click(function() {
                $("> :eq(0)", document.getElementById(container_id)).toggle(0);
                if (document.getElementById(search_main_category_arrow).className == 'collapse')
                {
                    document.getElementById(search_main_category_arrow).className = 'expand';
                    document.getElementById(search_main_category).className = 'text';
                }
                else
                {
                    document.getElementById(search_main_category_arrow).className = 'collapse';
                    document.getElementById(search_main_category).className = 'text_expanded';
                }
            });
        }
        if (document.getElementById(container_id)){
            $("."+container_id).click(function() {
            	$("> :eq(0)", this).toggle(0);
            });
        }        
    }
    
    //search comboboxes
    set_combo("toggler2","toggler","search_main_category_arrow","search_main_category");
    set_combo("toggler4","toggler3","search_sec_category_arrow","search_sec_category");
    set_combo("toggler5","toggler51","search_main_category_arrow5","search_main_category5");
    set_combo("toggler6","toggler61","search_sec_category_arrow6","search_sec_category6");
        		
    //venue comments		
    if (document.getElementById("comments")){
        $(".comments").click(function() {
            document.getElementById("tcomments").style.display="block";
            $("> :eq(0)", document.getElementById("tcomments")).toggle(0);
            
            if (document.getElementById('carrow').className == 'arr_down')
            {
                document.getElementById('carrow').className = 'arr_up'
            }
            else
            {
              document.getElementById('carrow').className = 'arr_down'
            }		  
        });		
    }
	if (document.getElementById("tcomments")){
  	     $("> :eq(0)", document.getElementById("tcomments")).toggle("blind");
  	}
  	 
  	//home page acordion
  	if (document.getElementById("accordion"))
  	window.setInterval('$("#accordion").accordion({header: "h3"});',1000);

  	//home page acordion_blogs
  	if (document.getElementById("accordion_blogs"))
  	window.setInterval('$("#accordion_blogs").accordion({header: "h3"});',1000);

  	//right acordion_blogs
  	if (document.getElementById("accordion_blogs_right"))
  	window.setInterval('$("#accordion_blogs_right").accordion({header: "h3"});',1000);
		
 	//search calendar animation and functions  
    function emptyDays(date) {
        for (i = 0; i < natDays.length; i++) {
          if (date.getMonth() == natDays[i][0] - 1 && date.getDate() == natDays[i][1]) {
            return [false, natDays[i][2] + '_day'];
          }
        }
        return [true,''];
    } 
    if (document.getElementById("calendar")){
        natDays = [['ie'],['ie'],['ie']];
 		$("#calendar").datepicker({duration: 0,minDate: -0, maxDate: '+6M', showAnim: 'slideDown',beforeShowDay: emptyDays
        ,onClose: function(date) {
          document.getElementById('calendar').className  = "date";
        }
     });
  	}

    if (document.getElementById("calendarinline")){

        var $myDate=new Date();
        var $cd = new String (querySt('day'));

        if ($cd.charAt(9) >''){
            $myDate.setFullYear($cd.charAt(6)+$cd.charAt(7)+$cd.charAt(8)+$cd.charAt(9),parseInt($cd.charAt(0)+$cd.charAt(1))-1,$cd.charAt(3)+$cd.charAt(4));
        }else{
            var $myDate=new Date();
        }
        
        natDays = [['ie'],['ie'],['ie']];
 		$("#calendarinline").datepicker({
 		     
 		     dayNamesMin: ['Du', 'Lu', 'Ma', 'Mi', 'Jo', 'Vi', 'Sa'] ,
 		     monthNames: ['Ianuarie','Februarie','Martie','Aprilie','Mai','Iunie','Iulie','August','Septembrie','Octombrie','Noiembrie','Decembrie'] ,
     		 onSelect: function(dateText) { location.href='/search_advance?day='+dateText},
     		 defaultDate:$myDate
     		}
         );

  	}
  	
    if (document.getElementById("form_sdate_day")){
        natDays = [['ie'],['ie'],['ie']];
 		$("#form_sdate_day").datepicker({duration: 0,minDate: -0, maxDate: '+6M', showAnim: 'slideDown',beforeShowDay: emptyDays
        ,onClose: function(date) {
          
        }
     });
  	}  	

    if (document.getElementById("form_edate_day")){
        natDays = [['ie'],['ie'],['ie']];
 		$("#form_edate_day").datepicker({duration: 0,minDate: -0, maxDate: '+6M', showAnim: 'slideDown',beforeShowDay: emptyDays
        ,onClose: function(date) {
          
        }
     });
  	}  	
  	
  	//event and location gallery 
    if (document.getElementById("mycarousel")){
        jQuery('#mycarousel').jcarousel();
    }

    //select main town location       
    if (document.getElementById("region_select")){
        $.cluetip.setup({insertionElement: '#region_select_container'});
    } 
    $('a.region_select:eq(0)').cluetip({
      cluetipClass: 'jtip',
      ajaxCache:true, 
      cursor: 'pointer',
      positionBy:'bottomTop',
      arrows: true, 
      dropShadow: false,
      hoverIntent: false,
      showTitle:false,
      activation:'click',    
      sticky: true,
      width:320,
      fixedX: 18,
      mouseOutClose: true,
      closePosition: 'title',
      topOffset:-17
    });

    //select post tv in program tv    
    $('a.alege_program:eq(0)').cluetip({
      cluetipClass: 'jtip',
      ajaxCache:true, 
      positionBy:'bottomTop',
      arrows: true,
      fixedX: 200, 
      dropShadow: false,
      hoverIntent: false,
      showTitle:false,
      activation:'click',    
      sticky: true,
      width:600,
      mouseOutClose: true,
      closePosition: 'bottom',
      leftOffset:600
      
    });
    //program tv tool tip
    $('a.load-local').cluetip({local:true, cursor: 'pointer',positionBy:'fixed',topOffset: 10,leftOffset:-130 });
    
    //calendar clue tip 
    $('a.load-more').cluetip({local:true, cursor: 'pointer',positionBy:'fixed',leftOffset:-50,mouseOutClose:true,hoverIntent: false,activation:'click',cluetipClass: 'jtip',closeText:'Close',fx: {open:'slideDown',openSpeed:'111'},topOffset: 30});
    
    $('a.load-movie').cluetip({local:true, cursor: 'pointer',topOffset: -25,leftOffset:-125,mouseOutClose:true,hoverIntent: false,activation:'click',cluetipClass: 'jtip',closeText:'Close'});
  });     
}


/////////////////////////////////////////////////
//START YAHOO MAP OBJECT IN PAGES 
/////////////////////////////////////////////////
function startMap(){
    document.map = new YMap(document.getElementById('yahoo_map_zone_div'));       
    document.map.addTypeControl();     
    document.map.addZoomLong();            
    document.map.addPanControl();    
    document.map.drawZoomAndCenter("Bucharest", 3);
    
    var currentGeoPoint = new YGeoPoint(document.getElementById('maplat').value,document.getElementById('maplon').value);  
    document.map.addMarker(currentGeoPoint);  
    
      
    YEvent.Capture(document.map, EventsList.MouseClick, myCallback);  
    
    function myCallback(_e, _c){  
        var mapCoordCenter = document.map.convertLatLonXY(document.map.getCenterLatLon());  
        placeMarker(new YGeoPoint( _c.Lat, _c.Lon));
        
               
        document.getElementById('maplat').value = _c.Lat;  
        document.getElementById('maplon').value = _c.Lon;
        
    }  
    
    function placeMarker(geoPoint){  
        document.map.addOverlay(new YMarker(geoPoint));  
    }  
} 

/////////////////////////////////////////////////
//v1 RIGHT FADE IN MENIU WITH CATEGORIES         
/////////////////////////////////////////////////
function meniu (o,s,e){
    o.s = s
    o.e = e
    document.anim = new Object;
    
    document.gogo = function (){
      document.anim[document.target.id] = new YAHOO.util.Anim(document.target.id, {height: { to: document.target.s }},0.5);document.anim[document.target.id].onComplete.subscribe(function(){document.target['start'] = true;});document.anim[document.target.id].animate();
    }
    
    o.omout = function (){
      if (typeof document.target != 'undefined' )
      {
          if (typeof document.anim[this.id] != 'undefined' ){
            if (typeof document.anim[this.id]['out'] != 'undefined' ){
              clearInterval(document.anim[this.id]['out']);
            }
            document.anim[this.id]['out'] = setTimeout ("document.gogo()", 1000 );
          }
      }
    }
    o.omover = function (){
    
      if (typeof document.anim[this.id] != 'undefined' ){
        clearInterval(document.anim[this.id]['out']);
      }
    
      document.target= this
      document.target['start'] = true
      if (document.target['start'] == true )
      {
          document.target['start'] = false;
          document.target['of']= true
          document.anim[this.id] = new YAHOO.util.Anim(this.id, {height: { to: this.e }},0.5);
          document.anim[this.id].onComplete.subscribe(function(){document.target['of']= false;});
          document.anim[this.id].animate();
      }
    }
    if (typeof document[o.id+"init"] == 'undefined' )
    {
      o.onmouseover = o.omover;
      o.onmouseout = o.omout;
    }
    else
    {
      document[o.id+"init"] = true
    }
}