// JavaScript Document


function getFlashVersion(){ 
  // ie 
  try { 
    try { 
      // avoid fp6 minor version lookup issues 
      // see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/ 
      var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); 
      try { axo.AllowScriptAccess = 'always'; } 
      catch(e) { return '6,0,0'; } 
    } catch(e) {} 
    return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1]; 
  // other browsers 
  } catch(e) { 
    try { 
      if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){ 
        return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]; 
      } 
    } catch(e) {} 
  } 
  return '0,0,0'; 
} 
 
function writeLogo(){
	var version = getFlashVersion().split(',').shift(); 
	if(version < 10){ 
	  document.write('<p><a href="http://www.zodiac-travel.ro"><img src="http://www.zodiac-travel.ro/images/zodiac_travel_logo.jpg" alt="Zodiac Travel" width="174" height="103" /></a></p>');
	}else{ 
	  document.write(''+
						  '<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="174" height="103">'+
						  '<param name="movie" value="http://www.zodiac-travel.ro/images/logo1.swf" />'+
						  '<param name="quality" value="high" />'+
						  '<param name="wmode" value="opaque" />'+
						  '<param name="swfversion" value="6.0.65.0" />'+
						  '<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->'+
						  '<param name="expressinstall" value="Scripts/expressInstall.swf" />'+
						  '<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->'+
						  '<!--[if !IE]>-->'+
						  '<object type="application/x-shockwave-flash" data="http://www.zodiac-travel.ro/images/logo1.swf" width="174" height="103">'+
							'<!--<![endif]-->'+
							'<param name="quality" value="high" />'+
							'<param name="wmode" value="opaque" />'+
							'<param name="swfversion" value="6.0.65.0" />'+
							'<param name="expressinstall" value="http://www.zodiac-travel.ro/javascript/expressInstall.swf" />'+
							'<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->'+
							'<div>'+
							'   <p><a href="http://www.zodiac-travel.ro"><img src="http://www.zodiac-travel.ro/images/zodiac_travel_logo.jpg" alt="Zodiac Travel" width="174" height="103" /></a></p>'+
							'</div>'+
							'<!--[if !IE]>-->'+
						  '</object>'+
						  '<!--<![endif]-->'+
						'</object>'+
						'<script type="text/javascript">'+
						'	swfobject.registerObject("FlashID");'+
						'</script><p style="color:#6d217b;font-size:12px; text-align:center"><strong>Vacante inspirate de zodii.</strong></p>');
	}
}

$(document).ready(function() {
	
	$(function() {
        $('.lightbox').lightBox();
    });
	
	//=========pop up calculatoare===============
    var closeModal = function(hash){
		var $modalWindow = $(hash.w);
	
		$modalWindow.fadeOut('2000', function(){
			hash.o.remove();
			//refresh parent
			if (hash.refreshAfterClose === 'true'){
				window.location.href = document.location.href;
			}
		});
	};
	var openInFrame = function(hash){
		var $trigger = $(hash.t);
		var $modalWindow = $(hash.w);
		var $modalContainer = $('iframe', $modalWindow);
		var myUrl = $trigger.attr('href');
		var myTitle = $trigger.attr('title');
		var newWidth = 0, newHeight = 0, newLeft = 0, newTop = 0;
		$modalContainer.html('').attr('src', myUrl);
		$('#jqmTitleText').text(myTitle);
		myUrl = (myUrl.lastIndexOf("#") > -1) ? myUrl.slice(0, myUrl.lastIndexOf("#")) : myUrl;
		var queryString = (myUrl.indexOf("?") > -1) ? myUrl.substr(myUrl.indexOf("?") + 1) : null;
	
		if (queryString != null && typeof queryString != 'undefined'){
			var queryVarsArray = queryString.split("&");
			for (var i = 0; i < queryVarsArray.length; i++){
				if (unescape(queryVarsArray[i].split("=")[0]) == 'width'){
					var newWidth = queryVarsArray[i].split("=")[1];
				}
				if (escape(unescape(queryVarsArray[i].split("=")[0])) == 'height'){
					var newHeight = queryVarsArray[i].split("=")[1];
				}
				if (escape(unescape(queryVarsArray[i].split("=")[0])) == 'jqmRefresh'){
					hash.refreshAfterClose = queryVarsArray[i].split("=")[1]
				} else {
					hash.refreshAfterClose = false;
				}
			}
			// let's run through all possible values: 90%, nothing or a value in pixel
			if (newHeight != 0){
					if (newHeight.indexOf('%') > -1){
						newHeight = Math.floor(parseInt($(window).height()) * (parseInt(newHeight) / 100));
					}
					var newTop = Math.floor(parseInt($(window).height() - newHeight) / 2);
				}
			else{
				newHeight = $modalWindow.height();
			}
			if (newWidth != 0){
				if (newWidth.indexOf('%') > -1){
					newWidth = Math.floor(parseInt($(window).width() / 100) * parseInt(newWidth));
				}
				var newLeft = Math.floor(parseInt($(window).width() / 2) - parseInt(newWidth) / 2);
			}else{
				newWidth = $modalWindow.width();
			}
	
			// do the animation so that the windows stays on center of screen despite resizing
			$modalWindow.css({
				width: newWidth,
				height: newHeight,
				opacity: 0
			}).jqmShow().animate({
				width: newWidth,
				height: newHeight,
				top: newTop,
				left: newLeft,
				marginLeft: 0,
				opacity: 1
			}, 'slow');
		}else{
			// don't do animations
			$modalWindow.jqmShow();
		}
	
	}
	$('#modalWindow').jqm({
		overlay: 70,
		modal: true,
		trigger: '.thickbox',
		target: '#jqmContent',
		onHide: closeModal,
		onShow: openInFrame
	});
	//=========pop up calculatoare===============
	
	$('a.one-star').click(function() {
  		$('a.one-star').css("width",'20px');
		$('a.one-star').css("background",'url(../images/alt_star.gif) left bottom');
		$("#stele").attr("value", "1");
		return false;
	});
	$('a.two-stars').click(function() {
  		$('a.two-stars').css("width",'40px');
		$('a.two-stars').css("left",'0px');
		$('a.two-stars').css("background",'url(../images/alt_star.gif) left bottom');
		$("#stele").attr("value", "2");
		return false;
	});
	$('a.three-stars').click(function() {
  		$('a.three-stars').css("width",'60px');
		$('a.three-stars').css("left",'0px');
		$('a.three-stars').css("background",'url(../images/alt_star.gif) left bottom');
		$("#stele").attr("value", "3");
		return false;
	});
	$('a.four-stars').click(function() {
  		$('a.four-stars').css("width",'80px');
		$('a.four-stars').css("left",'0px');
		$('a.four-stars').css("background",'url(../images/alt_star.gif) left bottom');
		$("#stele").attr("value", "4");
		return false;
	});
	$('a.five-stars').click(function() {
  		$('a.five-stars').css("width",'100px');
		$('a.five-stars').css("left",'0px');
		$('a.five-stars').css("background",'url(../images/alt_star.gif) left bottom');
		$("#stele").attr("value", "5");
		return false;
	});
	
	//$('#over_pr').css("display",'none');
	//if(getCookie('clsC') != 'close'){
		//$('#over_pr').css("display",'block');
	//}

	
	$('#close_pr').click(function() {
		setCookie('clsC', 'close', 600000);
		$('#over_pr').css("display",'none');

		return false;
	});
		
});



function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function setCookie(c_name,value,expiresec){
	var exdate=new Date();
	exdate.setTime(exdate.getTime()+expiresec);
	document.cookie=c_name+ "=" +escape(value)+((expiresec==null) ? "" : ";expires="+exdate.toGMTString());
}



function change_input_text(display_text, id){
	var get_value = document.getElementById(id).value;
	if(get_value == "" || display_text == ""){
		document.getElementById(id).value = display_text;
		return true;
	}else{
		return false;
	}
}

function set_star(){
	var get_value = document.getElementById('star').value;
}

function compatibilitate(){
	var get_value_1 = document.getElementById('zodie_1').options[document.getElementById('zodie_1').selectedIndex].value;
	var get_value_2 = document.getElementById('zodie_2').options[document.getElementById('zodie_2').selectedIndex].value;
	if(get_value_1 != "" && get_value_2 != ""){
		document.myform.submit();
	}
}


