    <link rel="stylesheet" type="text/css" href="http://www.itla.org.il/destGallery/css/thumbGrid.css"/>
    <script src="<?=$b_webPath?>destGallery/js/jquery.mb.browser.min.js"></script>
    <script src="<?=$b_webPath?>destGallery/js/jquery.mb.CSSAnimate.min.js"></script>
    <script src="<?=$b_webPath?>destGallery/js/jquery.mb.thumbGrid.js"></script>
    <script src="<?=$b_webPath?>bash-xtra/bashro_search_js.js"></script>



<script>
$(document).ready(function(){
bs_getTheO();
bs_s_syncS();
bs_s_showHide('robash_s_type','bash_bs_cID_div');
	$("#robash_s_ob,#robash_s_pp,#robash_s_page").change(function() {
	bs_newOrder();	
	});	
	
	
	$('#robash_s_execute').click(function(){
		bs_s_preCheck(bash_s_arr,bash_s_arrTC);
	});
	

	
	
});

function bs_preCheck_Dates(){
true_sD=$('#robash_s_sD').val();
true_fD=$('#robash_s_fD').val();
toRunBack='false';
	if(true_sD==$('#the_s_sD').val() && true_fD==$('#the_s_fD').val() ){}
	else{
	toRunBack=4;
	tmp_sD=true_sD.replace(/-/g, '');
	tmp_fD=true_fD.replace(/-/g, '');
		if(true_sD==''){
		$('#robash_s_sD').val('0');
		$('#the_s_sD').val('0');
		true_sD='0';
		tmp_sD='0';
		}
		if(true_fD==''){
		$('#robash_s_fD').val('0');
		$('#the_s_fD').val('0');
		true_fD='0';
		tmp_fD='0';
		}
		if(true_sD.indexOf('-')==-1 && tmp_sD!='0' ){toRunBack=-2;}
		else if(true_fD.indexOf('-')==-1 &&  tmp_fD!='0' ){toRunBack=-2;}
		else if(Number(tmp_fD)<Number(tmp_sD) && tmp_fD!='0'){toRunBack=-2;}
		if(toRunBack==-2){
		$('#robash_s_sD').val('0');
		$('#robash_s_fD').val('0');	
		$('#the_s_sD').val('0');
		$('#the_s_fD').val('0');	
//		$('#robash_s_sD').focus();
		}
	}
return toRunBack;
}

function bs_s_preCheck(bash_s_arr,bash_s_arrTC){
resBack='';
errTxt='';
toRun=0;isTitle=0;
	for (var i = 0; i < bash_s_arrTC.length; i++){
		if(	$('#the_s_'+bash_s_arrTC[i]).val()!=$('#robash_s_'+bash_s_arrTC[i]).val()	){
		toRun++;
			if(bash_s_arrTC[i]=='sTitle'){isTitle=1;}
		}
	}
	
	if(isTitle==1){
	sT_Size=$('#robash_s_sTitle').val().length;
		if($('#robash_s_sTitle').val().replace(/ /g, '')==''){toRun--;}
		else if(sT_Size>0 &&  sT_Size<3){
		toRun=-2;
		errTxt+=' - טקסט חופשי שגוי ';
		$('#robash_s_sTitle').val('');
		$('#the_s_sTitle').val('');
		$('#robash_s_sTitle').focus(); 
		}
	}

	if(toRun>=0){
		if(	$('#robash_s_type').val()=='file' || $('#robash_s_type').val()=='img'){
			if($('#the_s_cID').val()!=$('#robash_s_cID').val() ){
			toRun++;
			}
		}
	}
	
	if(toRun>=0){
	preCheck_Dates=bs_preCheck_Dates();
		if(preCheck_Dates=='false'){}
		else {
		toRun=preCheck_Dates;
			if (preCheck_Dates<0){$('#robash_s_sD').focus(); errTxt+=' - תאריך שגוי ';}
		}
	}

	if(toRun>0){
	$('#bashro_main_resAlertDiv').fadeIn(100).html('<div class="redMust">מבצע חיפוש<br><img src="http://www.itla.org.il/bash-xtra/img/icon_loading.gif"  width="100px" height="100px"/></div>');
	bs_s_syncS();
	}
	else if(toRun==0){
	$('#bashro_main_resAlertDiv').fadeIn(500).html('<div class="redMust">לא בוצע שינוי בנתונים לחיפוש</div>');
	$("#bashro_main_resAlertDiv").fadeOut(2500).delay(12500);
	}
	else if(toRun<0){
	$('#bashro_main_resAlertDiv').fadeIn(500).html('<div class="redMust">אחד הנתונים היה שגוי '+errTxt+' </div>');
	$("#bashro_main_resAlertDiv").fadeOut(2500).delay(12500);
	}
}

function bs_s_syncS(){
resBack='';	
var oToP={};
	for (var i = 0; i < bash_s_arr.length; i++){	
	oToP[bash_s_arr[i]] =$('#robash_s_'+bash_s_arr[i]).val();
	}
	$.post(
	"http://www.itla.org.il/bash-proce/bash_sProce.php",
	{doW:'get_newO',the_dataArr:oToP},
	function(data){
		if(data==false){
		$('#bashro_main_resAlertDiv').fadeIn(500).html('<div class="redMust">לא נמצאו תוצאות רלוונטיות</div>');
		}
		else{
		$('#bashro_main_resAlertDiv').fadeIn(500).html('<div class="greenOK">תוצאות החיפוש עודכנו</div>');
		$("#bashro_main_resAlertDiv").fadeOut(500).delay(3500);
		$('#the_s_arr').val(JSON.stringify(data));	
		$('#the_s_arrNum').val(data.length);	
		bs_newOrder();
		bs_s_offSet();
		}
	},
	'json');
}

function bs_s_offSet(){
	for (var i = 0; i < bash_s_arr.length; i++){
	$('#the_s_'+bash_s_arr[i]).val($('#robash_s_'+bash_s_arr[i]).val());
	}
}

function bs_s_showHide(curID,dID){
	if( $('#'+curID).val()=='file' || $('#'+curID).val()=='img'	){
	$('#'+dID).show();
	}
	else{
	$('#'+dID).hide();
	}
}
</script>

<?
$bs_sID=0;	$bs_d_name='';	$bs_d_fID=0;	$bs_pp='30';	$bs_page=1;		$bs_sD='';		$bs_fD='';  $bs_d_name_holder='כתבו ובחרו מהרשימה שתופיע';
$bs_cID='';
$bs_file_cat='';
$bs_sTitle='';
$bs_type='file';
$bs_ob='date_late';
$bs_fD_display=date("d-m-y");
$bs_slctedDest='<input id="cSearch"  style="margin-bottom:0;width:120px;" class="fSearch" type="text" autocomplete="off" name="cSearch" value=""  onkeyup="bashSearchCity(this.id);" >';
//$bs_cID_display='none';

//$bs_sCond='flower';
//if(is_user_logged_in()){	//$bs_sCond='tree';	}
//$bs_fD_display=date("d-m-Y H:i:s");

	if( isset($_GET['bash_id']) && $_GET['bash_id']>0 ){
	$bs_sID=$_GET['bash_id'];
	$bs_d_name_holder=$bs_d_name=get_the_title($bs_sID);
	$bs_slctedDest=$bs_d_name.'&nbsp;&nbsp;&nbsp;&nbsp;<span id="bs_changeDestSpan" onclick="bs_changeDest();" class="redMust f10">X שנה יעד</span>';
	}
	else{}
	if( isset($_GET['bash_pp'])){	$bs_pp=$_GET['bash_pp'];	}
	if( isset($_GET['bash_page'])){	$bs_page=$_GET['bash_page'];	}
	if( isset($_GET['bash_type'])){	$bs_type=$_GET['bash_type'];	}
	if( isset($_GET['bash_sD'])){	$bs_sD=$_GET['bash_sD'];	}	
	if( isset($_GET['bash_fD'])){	$bs_fD=$_GET['bash_fD'];	}
	if( isset($_GET['bash_cID'])){	$bs_cID=$_GET['bash_cID'];	}	

//if($bs_type=='file'){$bs_cID_display='';}
?>
<h3>חיפוש <?=$bs_d_name?></h3>
<div>
<style>
.bash_bs_box{ display:inline-block; margin:0 5px 10px 5px;}
.bash_bs_box input ,.bash_bs_box select { margin-bottom:0}
.bash_bs_mBlock{display:inline-block; background:#efefef; border-radius:5px; margin-top:10px;}
#robash_s_ob{ font-size:12px}
.bash_dateField{ width:60px; font-size:11px;}
#bashro_main_resAlertDiv{ text-align:center}
#bs_changeDestSpan{ cursor:pointer}
#bs_changeDestSpan:hover{ opacity:0.7}
#bashro_resText{ clear:both; width:100%; text-align:center;}
</style>
<div class="bash_bs_mBlock">


<div class="bash_bs_box">
&nbsp;סוג מידע:<br>
<select id="robash_s_type" style="width:100px" onChange="bs_s_showHide('robash_s_type','bash_bs_cID_div')">
<?=$b_D->bs_rollOptions(array('img'=>'תמונות','file'=>'קבצים','tLeader'=>'חברי ארגון','artiPost'=>'כתבות'),$bs_type);?>
</select>
</div>


<div class="bash_bs_box">
<div style="display:inline-block; width:100% ">
&nbsp;בחרו יעד:<br>
<span id="the_bashro_s_span"><?=$bs_slctedDest?></span>
<input id="robash_s_id" type="hidden" name="robash_s_id" value="<?=$bs_sID?>">
<input id="bashro_sa" value="s" type="hidden">
<br>
<div id="showMyLike"></div>
</div>
</div>



<div id="bash_bs_cID_div" class="bash_bs_box">
<select id="robash_s_cID" style="width:200px">
<?=$b_D->bs_rollFileCats()?>
</select>


</div>

<div class="bash_bs_box">
&nbsp;מתאריך:<br>
<input id="robash_s_sD" type="text"  name="robash_s_sD" value=""  class="bash_dateField">
</div>

<div class="bash_bs_box">
&nbsp;עד תאריך:<br>
<input id="robash_s_fD" type="text" name="robash_s_fD"   value="" class="bash_dateField">
</div>


<div class="bash_bs_box">
חיפוש טקסט בכותרת<span class="f10">(מינ' 3 אותיות)</span> <br>
<input id="robash_s_sTitle" type="text" name="robash_s_sTitle" placeholder="<?=$bs_sTitle?>" value=""  style="width:150px" >
</div>


<div class="bash_bs_box">
&nbsp; &nbsp; <br>
<input id="robash_s_execute" type="button" name="robash_s_execute"  value="חפש">
</div>


</div>
<div style="clear:both" ><div id="bashro_main_resAlertDiv"></div></div>
<div class="bash_bs_mBlock">

<div class="bash_bs_box">
&nbsp;סדר לפי:<br>
<select id="robash_s_ob"  style="width:150px">
<option value="date_late" selected="selected">תאריך <span class="f10">(מהחדש לישן)</span></option>
<option value="date">תאריך <span class="f10">(מהישן לחדש)</span></option>
<option value="name">שם</option>
<option value="fileSize">גודל קובץ</option>
<option value="fileSize_big">גודל קובץ <span class="f10">(מהגדול לקטן)</span></option>
</select>
</div>
<div class="bash_bs_box">
&nbsp;מס' תוצאות:<br>

<select id="robash_s_pp" style="width:72px">
<?=$b_D->bs_rollOptions(array(3=>3,20=>20,50=>50,100=>100),$bs_pp);?>
</select>
</div>
<div class="bash_bs_box">
&nbsp;עמוד:<br>

<select id="robash_s_page"  style="width:52px">
<option value="1" selected="selected">1</option>
</select>
</div>
</div>
<!-- bashS Form End-->

</div>


<!-- robash_s_id-->
<div id="packInfoDiv"></div>
<input type="hidden" value="<?=$bs_type?>" id="the_s_type" />
<input type="hidden" value="<?=$bs_sID?>" id="the_s_id" />
<!-- <input type="hidden" value="<? //=$bs_sCond?>" id="the_s_cond" /> -->
<input type="hidden" value="<?=$bs_ob?>" id="the_s_ob" />
<input type="hidden" value="<?=$bs_pp?>" id="the_s_pp" />
<input type="hidden" value="<?=$bs_sTitle?>" id="the_s_sTitle" />
<input type="hidden" value="<?=$bs_sD?>" id="the_s_sD" />
<input type="hidden" value="<?=$bs_fD?>" id="the_s_fD" />
<input type="hidden" value="<?=$bs_cID?>" id="the_s_cID" />
<input type="hidden" value="<?=$bs_page?>" id="the_s_page" />
<input type="hidden" value="0" id="the_s_arrNum" />
<input type="hidden" value="" id="the_s_destName" />
<input type="hidden" value="" id="the_s_arr" />

<div id="bashro_resText"></div>
<div id="bashro_main_resDiv">
<? //=$b_D->bs_displayFileInDest($b_D->bs_getTheFiles($bs_sID,is_user_logged_in(),$bs_type,1000,'',''),$bs_type,$bs_pp);?>
</div>
