<?php $lang=Yii::app()->session['lang'] ;
header('Content-Type:text/css'); 
?>


			 
				$bgStyle=<?$item->bg_color!=null?"background-color:#".$item->bg_color.";":""?>;
				$headStyle=<?$item->head_color!=null?"background-color:#".$item->head_color."":""?>;
				
				$borderStyle=<?$item->border_color!=null?"background-color:#".$item->border_color.";":""?>;
			
			   $col2='<div class="col-sm-3-menu col-sm-3" style="'.<?= $bgStyle ?>.'">';
			   $col3=' </div><div class="col-sm-4-menu col-sm-3" style="'.<?= $bgStyle ?>.'">
			   <button onclick="finance()"  class="btn btn-calculate-1" type="button" name="calculate1">'.($lang=="ar"?"احتساب التمويل":"Financial calculator").'</button><br/>
			   <button onclick="earnings()" class="btn btn-calculate-1" type="button" name="calculate1">'.($lang=="ar"?"احتساب الأرباح":"Profits calculator").'</button> 
				
			   </div>';
				 $i++;
				 $style_script.=$item->head_color==null?"":'
					#header .nav2 .nav-pills > li.menu'.$i.' > a.style
					{
					background-color: #'.$item->head_color.' !important;
					}';
					$style_script.=$item->bg_color==null?"":'#header .tab-content .tab-pane:first-child .list-menu-style li.list-style:hover{
					background-color: #'.$item->bg_color.' !important;
					}';
			   echo '<li class="menu'.$i.'" ><a data-toggle="pill" id="main-item-' . $item->id . '" class="newhover" href="'.((substr($item->link, 0, 4 ) === "http")?$item->link:('#menu'.$item->id)).'" > '.($lang=='en'?$item->en_title:$item->title).'  </a></li><li><span class="line-menu">|</span></li> ';
			   
			   $sub=$item->menuItems;  
			   if(sizeof($sub)>0)
			   {
				   $sub_menu.=' <div id="menu'.$item->id.'" class="tab-pane fade" >';
				   //background section
				   
					   if($item->image!=NULL)
					   {
						   $sub_menu.=' <div class="col-sm-1-menu col-sm-3" style="background-image: url('.<?=Yii::app()->request->baseUrl?>.'/uploads/MenuItem/'.$item->image.');">';
					   }else{
						   $sub_menu.=' <div class="col-sm-1-menu col-sm-3" style="background-image: url('.<?= Yii::app()->request->baseUrl?>.'/images/back-menu-1.jpg);">';
					   }
					   $sub_menu.=' <div class="col-sm-1-layer" style="'.<?= $headStyle ?>.'"> </div></div>';
				   
					   //first level menu
					   $sub_menu.='  <div class="col-sm-2-menu col-sm-3" style="'.<?= $headStyle ?>.'">';
					   $sub_menu.=' <ul class="list-menu-style">';
					  foreach($sub as $sub_item)
					   { 
					   $third_item=$sub_item->menuItems;
					   $plus=(sizeof($third_item))?'<div class="col-sm-1"> + </div>':'';
					   $sub_class=sizeof($third_item)>0?'class="list-style"  data-toggle="collapse" data-target="#sub-menu'.$item->id.'-menu'.$sub_item->id.'"':'class="list-style"';
					   $link=($sub_item->link=="#" || $sub_item->link=="")?"#":((substr($sub_item->link, 0, 4 ) === "http")?$sub_item->link:Yii::app()->request->baseUrl.$sub_item->link);
					   $sub_menu.=' <li '.$sub_class.'><a href="'.$link.'" data-parent="main-item-' . $item->id . '" data-url="' . $sub_item->link . '" class="expanded-menu-link">
					   <div class="col-sm-1"><div class="row"><span class="menu-icon center-block"></span></div></div><div class="col-sm-9"><div class="row">'.($lang=='en'?$sub_item->en_title:$sub_item->title).'</div></div>'.$plus.'</a></li>';
					   if($current_location==$sub_item->link)
					   echo '<script  type="application/javascript" src="'.Yii::app()->request->baseUrl.'/site/scriptMenu?id='.$item->id.'"></script>';
					   //second level
					   
					   if(sizeof($third_item)>0)
					   {
						   $col2.=' <ul id="sub-menu'.$item->id.'-menu'.$sub_item->id.'" class="collapse">';
						   foreach($third_item as $third_menu_item)
						   {
							   $class=sizeof($third_menu_item->menuItems)>0?' class="dropdown-toggle" data-toggle="dropdown"':'';
							   if($current_location==$third_menu_item->link)
							   echo '<script  type="application/javascript" src="'.Yii::app()->request->baseUrl.'/site/scriptMenu?id='.$item->id.'"></script>';
							   $col2.='<li class="list-style"><a data-parent="main-item-' . $item->id . '" data-url="' . $third_menu_item->link . '" class="expanded-menu-link" href="'.((substr($third_menu_item->link, 0, 4 ) === "http")?$third_menu_item->link:(Yii::app()->request->baseUrl.$third_menu_item->link)).'"' .$class.'><div class="col-sm-1"><div class="row"><img class="img-icon" src="'.Yii::app()->request->baseUrl.'/images/icon-menu3-black.png" alt="list-icon"></div></div><div class="col-sm-9"><div class="row"> '.($lang=='en'?$third_menu_item->en_title:$third_menu_item->title).' </div></div></a>';
							   if(sizeof($third_menu_item->menuItems))
							   {
								   $col2.='<div class="dropdown-menu">';
								   foreach($third_menu_item->menuItems as $last_level_menu)
								   $col2.='  <a  data-parent="main-item-' . $item->id . '" data-url="' . $last_level_menu->link . '"  href="'.((substr($last_level_menu->link, 0, 4 ) === "http")?$last_level_menu->link:(Yii::app()->request->baseUrl.$last_level_menu->link)).'" class="dropdown-item0 expanded-menu-link">'.($lang=='en'?$last_level_menu->en_title:$last_level_menu->title).'</a> ';
								   $col2.='</div>';
								   if($current_location==$last_level_menu->link)
								   echo '<script  type="application/javascript" src="'.Yii::app()->request->baseUrl.'/site/scriptMenu?id='.$item->id.'"></script>';
								}
							   $col2.='</li>';
						   }
						   $col2.='</ul>';
			  
					   }
				   }
				   $sub_menu.='</ul></div>';
				   $sub_menu.=$col2;
				   $sub_menu.=$col3;
				   $sub_menu.='</div>';
			   }
			   
			   
			 }
				 }
			