var http = null;
var ready = true;
var search_type = "name";
var lboxu_shown = false;        //
var lboxj_shown = false;        //
var typ_u_array = new Array();  //
var typ_j_array = new Array();  //++peter-2009-7-26
var u_state = new Array();      //
var j_state = new Array();      //
var fu = false;                 //
var fj = false;                 //
var allboxstate = "";
var allbox = "";

var inst_typs = new Array('','University','Institute','College','Academy','Polytechnic','Department','Faculty','Seminar','Organisation','Society, Association','Centre','Clinical Centre','Foundation','Networks','Company','Career Service','Agency','Library','Museum');
var job_typs = new Array('','','','','','Careers','News','Faculties','Colleges','Departments','Institutes','Scholarships','Degrees','Scientific Cooperations','Commercial Cooperations');

if (window.XMLHttpRequest)
{
     http = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
    http = new ActiveXObject("Microsoft.XMLHTTP");
} 



function show_search_result(param)
{
     param = '&'+param+'=all';
     if(document.getElementById("uni_search_field").value != '' || typ_u_array[0] > 0)
     {
//          var input = document.getElementById("language");
//          var language = input.value;
          ready = false;
          var rnd = Math.random ();
          var search = encodeURIComponent(document.getElementById("uni_search_field").value);
          if((search != '' && search.length > 2) || typ_u_array[0] > 0)
          {
              // if( jQuery( '#job_results_popup' ).dialog( 'isOpen' ) )
               	
                jQuery('#job_results_popup').dialog( 'open' );
	       
	       	//jQuery('#job_results_popup').dialog('option','width',1000);
               
               jQuery('#job_results_popup').load( httpAbsolutePath + 'unidir_popup.php?content=searchResults&searchword='+search+'&r='+Math.random()+'&box_u_state[]='+u_state+"&allboxstate="+allboxstate,
                    function()
                    {
                         jQuery('#sr').html( '<center><br><br><p><h3><b>searching...</b></h3><br><img src="'+httpAbsolutePath+'images/9.gif"></center>'  );
                         var url = httpAbsolutePath + "tools/search.php?search_u="+search+"&st="+search_type+param+"&box_u[]="+typ_u_array+"&"+rnd+"&allbox="+allbox;         
                         jQuery('#sr').load( url );
                    }
               );
               jQuery('#search_field').focus();    
	  }
     }
}
               
function show_job_result(param ) 
{
	  param = '&'+param+'=all';

          /**
           * AS 15.07.10
           * + || param == '&0000=all'
           */
     if(document.getElementById("search_job_field").value != '' || param == '&0000=all' || typ_j_array[0] > 0)
     {
          ready = false;
          var rnd = Math.random ();
          var search = escape(document.getElementById("search_job_field").value);
//          var search_u = document.getElementById("search_field").value;
//          var box = document.getElementById("mybox").checked;

            /**
           * AS 15.07.10
           * + || param == '&0000=all'
           */
	  if((search != '' && search.length > 2) || typ_u_array[0] > 0 || param == '&0000=all')
	  {
      jQuery('#job_results_popup').dialog( 'open' );
	  jQuery('#job_results_popup').load( httpAbsolutePath + 'unidir_popup.php?content=searchJobResults&searchword='+search+'&r='+Math.random()+'&box_j_state[]='+j_state+"&allboxstate="+allboxstate,
      function(){
				   jQuery('#sr').html( '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><center><br><br><p><strong>searching...</b></strong><br><img src="'+httpAbsolutePath+'images/9.gif"></center>'  );
                                   var url = httpAbsolutePath + "tools/jsearch.php?search="+search+param+"&box_j[]="+typ_j_array+"&box_u[]="+typ_u_array+"&"+rnd+"&allbox="+allbox;         
				  jQuery('#sr').load( url, function(){
                         	onResize();
                         } );
			      }
               );
               jQuery('#search_job_field').focus();   
	  }
     }  
}

function show_partner_result(param ) 
{
      param = '&'+param+'=all';
     if(document.getElementById("uni_search_field").value != '' || typ_j_array[0] > 0)
     {
          ready = false;
          var rnd = Math.random ();
          var search = escape(document.getElementById("uni_search_field").value);
//          var search_u = document.getElementById("search_field").value;
//          var box = document.getElementById("mybox").checked;
      if((search != '' && search.length > 2) || typ_u_array[0] > 0)
      {
      jQuery('#job_results_popup').dialog( 'open' );
      jQuery('#job_results_popup').load( httpAbsolutePath + 'unidir_popup.php?content=searchResults&searchword='+search+'&r='+Math.random()+'&box_j_state[]='+j_state+"&allboxstate="+allboxstate,
      function(){
                   jQuery('#sr').html( '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><center><br><br><p><strong>searching...</b></strong><br><img src="'+httpAbsolutePath+'images/9.gif"></center>'  );
                                   var url = httpAbsolutePath + "tools/jsearch.php?search_u="+search+param+"&box_j[]="+typ_j_array+"&box_u[]="+typ_u_array+"&"+rnd+"&allbox="+allbox;         
                  jQuery('#sr').load( url, function(){
                             onResize();
                         } );
                  }
               );
               jQuery('#uni_search_field').focus();   
      }
     }  
}

    function choose_job_result(id) {
        document.getElementById("search_field").value = document.getElementById("result-"+id+"").innerHTML;
        document.getElementById("i_id").value = id;
        document.getElementById("bc").value = 1;
        hide_search_result();
    }

    function highlight(id) {
        document.getElementById("result-"+id+"").style.background = "#F0F0F0";
    }

    function dehighlight(id) {
        document.getElementById("result-"+id+"").style.background = "white";
    }

   
    
    function hide_search_result() {
        document.getElementById("search_result_box").style.display = "none";
        document.getElementById("search_result_box").style.visibility = "hidden";
        document.getElementById("search_job_box").style.display = "none";
        document.getElementById("search_job_box").style.visibility = "hidden";
        //document.getElementById("inprogress_img").style.visibility = "hidden";
        
    }

    function choose_search_result(id) {
        document.getElementById("search_field").value = document.getElementById("result-"+id+"").innerHTML;
        document.getElementById("i_id").value = id;
        document.getElementById("bc").value = 1;
        hide_search_result();
    }
/*-Uni-Search-*/ 
function show_uni_result(param)
{
     param = '&'+param+'=all';
     if(document.getElementById("uni_search_field").value != '' || typ_u_array[0] > 0)
     {
          var input = document.getElementById("language");
          var language = input.value;
          ready = false;
          var rnd = Math.random ();
          var search = encodeURIComponent(document.getElementById("search_uni_field").value);
          if((search != '' && search.length > 2) || typ_u_array[0] > 0)
            {
            jQuery('#results_popup').dialog( 'open' );
            jQuery('#results_popup').load( httpAbsolutePath + 'unidir_popup.php?content=searchResults&searchword='+search+'&r='+Math.random()+'&box_u_state[]='+u_state+"&allboxstate="+allboxstate,
                    function()
                    {
                     jQuery('#sr').html( '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><center><br><br><p><h3><b>searching...</b></h3><br><img src="'+httpAbsolutePath+'images/9.gif"></center>'  );
                     var url = httpAbsolutePath + "tools/search.php?search="+search+"&st="+search_type+param+"&box_u[]="+typ_u_array+"&"+rnd+"&lang="+language+"&allbox="+allbox;         
                     jQuery('#sr').load( url );
                    }
               );
               jQuery('#search_field').focus();    
      }
     }
}
               
function show_uni_result(param ) 
{
param = '&'+param+'=all';
     if(document.getElementById("search_uni_field").value != '' || typ_j_array[0] > 0)
     {
          ready = false;
          var rnd = Math.random ();
          var search = escape(document.getElementById("search_uni_field").value);
//          var search_u = document.getElementById("search_field").value;
//          var box = document.getElementById("mybox").checked;
      if((search != '' && search.length > 2) || typ_u_array[0] > 0)
      {
               jQuery('#results_popup').dialog( 'open' );
           jQuery('#results_popup').load( httpAbsolutePath + 'unidir_popup.php?content=searchResults&searchword='+search+'&r='+Math.random()+'&box_j_state[]='+j_state+"&allboxstate="+allboxstate,
            function(){
                   jQuery('#sr').html( '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><center><br><br><p><strong>searching...</b></strong><br><img src="'+httpAbsolutePath+'images/9.gif"></center>'  );
                                   var url = httpAbsolutePath + "tools/usearch.php?search_u="+search+param+"&box_j[]="+typ_j_array+"&box_u[]="+typ_u_array+"&"+rnd+"&allbox="+allbox;         
                  jQuery('#sr').load( url, function(){
                             onResize();
                         } );
                  }
               );
               jQuery('#search_uni_field').focus();   
      }
     }  
}

    function choose_uni_result(id) {
        document.getElementById("unisearch_field").value = document.getElementById("result-"+id+"").innerHTML;
        document.getElementById("i_id").value = id;
        document.getElementById("bc").value = 1;
        hide_search_result();
    }

    function hide_search_result() {
        document.getElementById("unisearch_result_box").style.display = "none";
        document.getElementById("unisearch_result_box").style.visibility = "hidden";
        document.getElementById("unisearch_job_box").style.display = "none";
        document.getElementById("unisearch_job_box").style.visibility = "hidden";
        //document.getElementById("inprogress_img").style.visibility = "hidden";
        
    }

    function choose_search_result(id) {
        document.getElementById("unisearch_field").value = document.getElementById("result-"+id+"").innerHTML;
        document.getElementById("i_id").value = id;
        document.getElementById("bc").value = 1;
        hide_search_result();
    }
/*-Uni-Search-*/ 
    function highlight(id) {
        document.getElementById("result-"+id+"").style.background = "#F0F0F0";
    }

    function dehighlight(id) {
        document.getElementById("result-"+id+"").style.background = "white";
    }


    function setSearchType(type) {
    search_type=type;
  }

function hit(id) {
        http.open("GET", "../../stats.php?hit="+id+"", false);
        http.onreadystatechange = function () {};
        http.send(null);
    }

function hits(type,id) {
        http.open("GET", "../../stats2.php?hit="+id+"&typ="+type+"", false);
        http.onreadystatechange = function () {};
        http.send(null);
    }

function bookmarksite(title, url){
  if (document.all)
    window.external.AddFavorite(url, title);
  else if (window.sidebar)
    window.sidebar.addPanel(title, url, "")
}
function addToFav()
{
  bookmarksite("University Directory", "http://www.university-directory.eu");
}

//++peter-2009-7-26
function accept_clicked(lbox)
{
     if(lbox == 'allbox')
     {
          if(document.allbox.elements[0].checked)
          {
               allboxstate = "checked";
               allbox = document.allbox.elements[0].value;
          }
          else
          {
               allboxstate = "";
               allbox = "";
          }
          
          show_search_result( '', httpAbsolutePath);
          
     }
     if(lbox == 'allboxj')
     {
          if(document.allbox.elements[0].checked)
          {
               allboxstate = "checked";
               allbox = document.allbox.elements[0].value;
          }
          else
          {
               allboxstate = "";
               allbox = "";
          }
          
          show_job_result( '', httpAbsolutePath);
          
     }
     if(lbox == 'box1')
     {
          typ_u_array=[];
             for(i=0;i<document.lbu.elements.length;i++)
          {
          	   if(document.lbu.elements[i].checked){
          	        typ_u_array.push(document.lbu.elements[i].value);
                    u_state[i]="checked";
               }
               else
               {
                    u_state[i]="";
               }
          }
          fu = true;
          fj = false;
          
          
          show_search_result( '', httpAbsolutePath);
          
     }
     if(lbox == 'box2')
     {
          typ_j_array=[];
          for(i=0;i<document.lbj.elements.length;i++)
          {
               if(document.lbj.elements[i].checked)
               {
                    typ_j_array.push(document.lbj.elements[i].value);
                    j_state[i]="checked";
               }
               else
               {
                    j_state[i]="";
               }
          }
          fj = true;
          fu = false;
          
          
          show_job_result( '', httpAbsolutePath );
          
     }
     
}

//++peter-2009-7-26
function set_flag(f)
{
     if(f == 'u')
     {
          fu = true;
          fj = false;
     }
     if(f == 'j')
     {
          fj = true;
          fu = false;
     }
}


function showOnMap1( url, id, address ){
	jQuery.get( url,
		{"instId": id, "address": address },
		function(data){
			jQuery( '#gm' ).html( data );
		} );
	jQuery( '#gm' ).dialog( {width:400, height:400} );
	jQuery( '#gm' ).dialog('open');
	jQuery( '#gm' ).show();
}

function showOnMap( url, street, address ){
        street = street.substring(0,street.indexOf('/'));
        //alert(street);
        address = street+", "+address;
	jQuery.modal("<iframe src='http://78.46.91.38/unidir/tools/gm.php?address="+address+"' scrolling='no' frameborder='1' marginheight='0px' marginwidth='0px' style='width:400px;height:400px;border-style:solid;border-width:1px'></iframe>",{
	overlay:80,
	overlayCss: {backgroundColor:"#000000"},
        overlayClose:true,
        position:['30%','30%'],
        close:true
});
}

function popup( content, baseurl, title, dir ){
	jQuery.getScript( baseurl + "tools/ajaxupload.js" );
	jQuery('#dialog').dialog( 'option', 'title', title );
	jQuery('#dialog').dialog( 'open' );
	jQuery('#dialog').load( baseurl + "unidir_popup.php?content=" + content + "&dir="+dir+"&r="+Math.random());
}

function filterSearch( callback, idPrefix, checkbox ){
	if( typeof(idPrefix) == 'undefined' ) idPrefix = '';
	if( jQuery('#'+idPrefix+'instFilterResults').length == 0 )
		jQuery("body").append( '<div class="instFilterResults" id="'+idPrefix+'instFilterResults"><img src="'+httpAbsolutePath+'images/loading.gif" alt="loading"></div>' );
	else
		jQuery('#instFilterResults').html( '<img src="'+httpAbsolutePath+'images/loading.gif" alt="loading">' );
	var offset = jQuery("input[name='"+idPrefix+"instname']").offset();
	jQuery('#'+idPrefix+'instFilterResults').show();
	if( checkbox ) offset.left = offset.left + 150;
	jQuery('#'+idPrefix+'instFilterResults').css( 'left', offset.left );
	jQuery('#'+idPrefix+'instFilterResults').css( 'top', offset.top+20 );
	var type = jQuery("select[name='"+idPrefix+"instSelector']").val();
	var q = escape( jQuery("input[name='"+idPrefix+"instname']").attr( 'value' ) );
	var land = jQuery("select[name='"+idPrefix+"landid']").val();
	var checkboxparam = '';
	if( checkbox == true )
		checkboxparam = '&checkboxes=1';
	var url = httpAbsolutePath + 'tools/loadDynamicContent.php?option=instFilterBar&type='+type+'&q='+q+'&land='+land+'&idPrefix='+idPrefix+checkboxparam+'&'+Math.random();
	jQuery("#"+idPrefix+"instFilterResults").load( url, callback );
}

function preparePopup( caption , title ){
	jQuery('#popup').html( caption );
	jQuery('#popup').dialog( 'option', 'title', title );
	jQuery('#popup').dialog( 'option', 'modal', true );
	jQuery('#popup').bind( 'dialogclose', function(event, ui){
		jQuery('#popup').dialog( 'option', 'modal', false );
		jQuery('#popup').dialog( 'option', 'title', '' );
		jQuery('#popup').dialog( 'option', 'buttons', {} );
	} );
}

function instFilterBar( idprefix, checkboxes ){
	var popup = "#selectinst_instFilterResults";
	var q = jQuery('input[name="'+idprefix+'instname"]').attr( 'value' );
	q = encodeURI( q );
	jQuery('#'+idprefix+'popup').bind( 'dialogclose', function( event, ui ){
		jQuery('#popup').dialog( 'close' );
	} );
	var l = jQuery("select[name='"+idprefix+"land']").val();
	var t = jQuery("select[name='"+idprefix+"insttype']").val();
	if( typeof( l ) == 'undefined' ) l = '0';
	if( typeof( t ) == 'undefined' ) t = '0';
	jQuery(popup).bind( 'dialogclose', function( event, ui ){
		jQuery(popup).css( 'height', '' );
		jQuery(popup).css( 'overflow', 'auto' );
	} );
	var types = '';
	jQuery(':checkbox:checked[name^=typ_]').each( function(){
		var n = this.name.substr( 4 );
		if( types != '' ) types += ',';
		types += n;
	});
	var allmatches = jQuery('input[name="selectinst_showAllMatches"]').attr( 'checked' ) ? '1' : '0';
	jQuery( popup ).html( '<img src="'+httpAbsolutePath+'images/loading.gif" alt="loading"/>' );
	jQuery( popup ).load( httpAbsolutePath + 'tools/loadDynamicContent.php'+
		'?option=instFilterBar&q='+q+'&idPrefix='+idprefix+'&land='+l+'&checkboxes='+checkboxes+'&allmatches='+allmatches+'&types='+types, function(){
		var f = function(){
			instFilterBar( idprefix, checkboxes );
		}
		jQuery("select[name='"+idprefix+"land']").change( f );
		jQuery("select[name='"+idprefix+"insttype']").change( f );
		
		var clickfunction_exists = false;
		eval( ' if( typeof( '+idprefix+'click ) == \'function\' ) clickfunction_exists = true; ' );
		if( clickfunction_exists ){
			eval( ' var clickfunction = '+idprefix+'click' );
			jQuery( '#selectinst_instFilterResults > span' ).bind( 'click', clickfunction );
//			alert( jQuery( '#selectinst_instFilterResults > span' ).size() );
		}
	} );
}

function treeSelector( idprefix ){
	//collect search options
	var popup = "#selectinst_instFilterResults";
	var q = jQuery('input[name="'+idprefix+'instname"]').attr( 'value' );
	if( typeof( q ) == 'undefined' ) q = '';
	q = encodeURI( q );
	var l = jQuery("select[name='"+idprefix+"land']").val();
	var t = jQuery("select[name='"+idprefix+"insttype']").val();
	if( typeof( l ) == 'undefined' ) l = '0';
	if( typeof( t ) == 'undefined' ) t = '0';
	var types = '';
	jQuery(':checkbox:checked[name^=typ_]').each( function(){
		var n = this.name.substr( 4 );
		if( types != '' ) types += ',';
		types += n;
	});
	var allmatches = jQuery('input[name="selectinst_showAllMatches"]').attr( 'checked' ) ? '1' : '0';
//	jQuery('#'+idprefix+'popup').bind( 'dialogclose', function( event, ui ){
//		jQuery('#popup').dialog( 'close' );
//	} );
	jQuery(popup).bind( 'dialogclose', function( event, ui ){
		jQuery(popup).css( 'height', '' );
		jQuery(popup).css( 'overflow', 'auto' );
	} );
	
	jQuery( popup ).html( '<img src="'+httpAbsolutePath+'images/loading.gif" alt="loading"/>' );
		
	//create get string to specify search options
	var options = 'q='+q+'&idPrefix='+idprefix+'&land='+l+'&allmatches='+allmatches+'&types='+types;
//	if( jQuery( '#'+idprefix+'expandLand' ).val() != '' )
//		options += '&expand='+jQuery( '#'+idprefix+'expandLand' ).val();
	treeSelector.options = options;
	jQuery( popup ).load( httpAbsolutePath + 'tools/loadDynamicContent.php'+
		'?option=treeSelector&'+options, function(){
		
		//get reference to nlstree and init next ajax call
		eval( 'var tree = nlsTree[ "'+idprefix+'tree" ];' );
		var treeOptions = options.replace( /idPrefix=.*&/g, "idPrefix=&" );
		nlsTree['selectinst_tree'].chUrl = httpAbsolutePath+'tools/loadDynamicContent.php?option=loadTree&'+treeOptions;

		var clickfunction_exists = false;
		eval( ' if( typeof( '+idprefix+'click ) == \'function\' ) clickfunction_exists = true; ' );
		if( clickfunction_exists ){
			eval( ' var clickfunction = '+idprefix+'click' );
			jQuery( '#selectinst_instFilterResults > span' ).bind( 'click', clickfunction );
		}
	} );
}

function readAjaxResponse( data ){
	var result = Array();
	result['type'] = data.substr( 0,3 );
	result['data'] = data.substr( 4 );
	return result;
}
function showJob( id, jobtyp, jtyp, university, country , httpAbsolutePath){
	if(id==0 || httpAbsolutePath == '' || httpAbsolutePath == 'undefined')
		window.open( 'http://www.euni.de/tools/jobpopup.php?jobid='+id+"&jobtyp="+jobtyp+"&jtyp="+jtyp+"&university="+university+"&country="+country, "", "width=1000,height=700,resizable=yes" );
	else
		window.open( httpAbsolutePath + 'tools/jobpopup.php?jobid='+id+"&jobtyp="+jobtyp+"&jtyp="+jtyp+"&university="+university+"&country="+country, "", "width=1000,height=700,resizable=yes" );
}

function search(){
   	if(document.getElementById("search_job_field").value != '' || typ_j_array[0] > 0)
    {
    	ready = false;
        var rnd = Math.random ();
        var search = escape(document.getElementById("search_job_field").value);
		if((search != '' && search.length > 2) || typ_u_array[0] > 0)
		{
        	jQuery('#job_results_popup').dialog( 'open' );
			jQuery('#job_results_popup').load( httpAbsolutePath + 'unidir_popup.php?content=searchJobResults&searchword='+search+'&r='+Math.random()+'&box_j_state[]='+j_state+"&allboxstate="+allboxstate,
			    function(){
					jQuery('#sr').html( '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><center><br><br><p><strong>searching...</b></strong><br><img src="'+httpAbsolutePath+'images/9.gif"></center>'  );
	                var url = httpAbsolutePath + "tools/search.php?search="+search+"&box_j[]="+typ_j_array+"&box_u[]="+typ_u_array+"&"+rnd+"&allbox="+allbox;         
					jQuery('#sr').load( url, function(){
	                	onResize();
	            		}
	            	);
				}
            );
        	jQuery('#search_job_field').focus();   
	  	}
     } 
}
function search(){
       if(document.getElementById("search_uni_field").value != '' || typ_j_array[0] > 0)
    {
        ready = false;
        var rnd = Math.random ();
        var search = escape(document.getElementById("search_uni_field").value);
        if((search != '' && search.length > 2) || typ_u_array[0] > 0)
        {
            jQuery('#uni_results_popup').dialog( 'open' );
            jQuery('#uni_results_popup').load( httpAbsolutePath + 'unidir_popup.php?content=searchUniResults&searchword='+search+'&r='+Math.random()+'&box_j_state[]='+j_state+"&allboxstate="+allboxstate,
                function(){
                    jQuery('#sr').html( '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><center><br><br><p><strong>searching...</b></strong><br><img src="'+httpAbsolutePath+'images/9.gif"></center>'  );
                    var url = httpAbsolutePath + "tools/search.php?search="+search+"&box_j[]="+typ_j_array+"&box_u[]="+typ_u_array+"&"+rnd+"&allbox="+allbox;         
                    jQuery('#sr').load( url, function(){
                        onResize();
                        }
                    );
                }
            );
            jQuery('#search_uni_field').focus();   
          }
     } 
}
function mycarousel_itemAddCallback(carousel, first, last, xml)
{
    // Set the size of the carousel
    carousel.size(parseInt(jQuery('total', xml).text()));
    jQuery('image', xml).each(function(i) 
        {
        carousel.add(first + i, mycarousel_getItemHTML(jQuery(this).text()));
        });
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(ustr)
{
    var pos  = ustr.indexOf('|');
    var posl = ustr.indexOf('#');
    if(pos<0 || posl<0)
        {
        return '<img class="pb_ic" src="' + ustr + '" border="0"/>';
        }
    var url  = ustr.substr(0,pos);
    var name = ustr.substr(pos+1,posl-pos-1);
    var link = ustr.substr(posl+1);
    if(url==' ')
        return '<a class="pb_link" href="'+link+'" title="'+name+'" target="_blank"> '+name+' </a></p>';
    else
        return '<a class="pb_ic" href="'+link+'" title="'+name+'" target="_blank"> '+name+' <p><img src="' + url + '" alt="'+name+'" border="0"/></a></p>';
//    return url;
};
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() 
        {
        carousel.startAuto(0);
        });
 
    carousel.buttonPrev.bind('click', function() 
        {
        carousel.startAuto(0);
        });
 
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() 
        {
        carousel.stopAuto();
        }, function()
        {
        carousel.startAuto();
        });
};

