/**
 * Initialize the PriceSlider
 */
function initPriceSlider(MinimumPricePerPerson,MaximumPricePerPerson) {
//alert('min'+MinimumPricePerPerson+'max'+MaximumPricePerPerson);
    var price1 = new Control.Slider('priceslider1','price', {
        axis:'horizontal',
        range:$R(0,5000),
        sliderValue:MinimumPricePerPerson,
        alignX:-5,
        values: [0,25,50,75,100,125,150,175,200,225,250,275,300,325,350,375,400,425,450,475,500,525,550,575,600,625,650,675,700,725,750,775,800,825,850,875,900,925,950,975,1000],

        onSlide:function(value){
            $('from_price').innerHTML = value + '&#8364;';
        },

        onChange:function(value){
            if( value != MinimumPricePerPerson ) {
                if($('MaximumPricePerPerson').className == 'changed') {
                    $('MinimumPricePerPerson').value = value;
                    addToFilter('add','selection',xajax.getFormValues('drill_down_form'),true,'body');
                }
                else {
                    $('MinimumPricePerPerson').className = 'changed'; 
                    $('MinimumPricePerPerson').value = value;   
                }
            }
        }
    });
    var price2 = new Control.Slider('priceslider2','price', {
        axis:'horizontal',
        range:$R(0,5000),
        alignX:9,
        values: [300,325,350,375,400,425,450,475,500,525,550,575,600,625,650,675,700,725,750,775,800,825,850,875,900,925,950,975,1000,1025,1050,1075,1100,1125,1150,1175,1200,1225,1250,1275,1300,1325,1350,1375,1400,1425,1450,1475,1500,1525,1550,1575,1600,1625,1650,1675,1700,1725,1750,1775,1800,1825,1850,1875,1900,1925,1950,1975,2000,2025,2050,2075,2100,2125,2150,2175,2200,2225,2250,2275,2300,2325,2350,2375,2400,2425,2450,2475,2500,2525,2550,2575,2600,2625,2650,2675,2700,2725,2750,2775,2800,2825,2850,2875,2900,2925,2950,2975,3000,3025,3050,3075,3100,3125,3150,3175,3200,3225,3250,3275,3300,3325,3350,3375,3400,3425,3450,3475,3500,3525,3550,3575,3600,3625,3650,3675,3700,3725,3750,3775,3800,3825,3850,3875,3900,3925,3950,3975,4000,4025,4050,4075,4100,4125,4150,4175,4200,4225,4250,4275,4300,4325,4350,4375,4400,4425,4450,4475,4500,4525,4550,4575,4600,4625,4650,4675,4700,4725,4750,4775,4800,4825,4850,4875,4900,4925,4950,4975,5000],
        sliderValue:MaximumPricePerPerson,

        onSlide:function(value){
            $('to_price').innerHTML = value + '&#8364;' ;
        },

        onChange:function(value){
            if( value != MaximumPricePerPerson ) {
                if($('MinimumPricePerPerson').className == 'changed') {
                    $('MaximumPricePerPerson').value = value;
                    addToFilter('add','selection',xajax.getFormValues('drill_down_form'),true,'body'); 
                }
                else {
                    $('MaximumPricePerPerson').className = 'changed'; 
                    $('MaximumPricePerPerson').value = value;  
                } 
            }
        }
    });
    return true;
}
/**
 * Initialize the StarSlider
 */
function initStarSlider(StarClassification) {
            var starslider = new Control.Slider('starslider','stars', {
            axis:'horizontal',
            range:$R(0,6),
            values:[0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6],
            onSlide:function(value){
                $('from_star').innerHTML = 'vanaf <b>' + value + '</b> <img src="/images/star.gif">';
            },
            onChange:function(value){
                if( value != StarClassification)
                    addToFilter('add','StarClassification',value,true,'contentContainer');
            }
            , sliderValue:StarClassification
            });
            return true;
}    

/**
 * switch visibility (display) between 2 objects
 * @param from - name of div
 * @param to - name of div
 */
function drilldown_toggle_options(from, to) {
     document.getElementById(from).style.display = 'none';
     document.getElementById(to).style.display = '';
     return false;
}

function togglediv(div) {
   display = $(div).style.display;    
   
   if (display == 'none')
   {
   	//ytw_call('modSearch', 'get_crit_options', [ 'tourops', 'TourOperator' ]);
   	
      $(div).style.display='block';
      $(div+"_h1").style.background='transparent url(/images/arrow_down.gif) no-repeat scroll left center';
   } 
    else 
   {    
      $(div).style.display='none';
      $(div+"_h1").style.background='transparent url(/images/arrow_right.gif) no-repeat scroll left center';
   }
}

function toggleOptions(from, to) {
	var from = $$('.'+from);
	var to = $$('.'+to);
	
	for (var i=0; i<from.length; i++) {
		from[i].style.display = 'none';
	}
	
	for (var i=0; i<to.length; i++) {
		to[i].style.display = 'block';
	}	
}

/**
 * Flash star functions
 */

function thisMovie(movieName) {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
}
var test=0;
function setStarText(text) {
	thisMovie("ThomasCook_star").stopCall(text);
	//$('footer').innerHTML = test;
	//test++;
}

function startCall() {
    thisMovie("ThomasCook_star").startCall(); 
}