/*GLOCAL ELEMENTS*/

var lastMenuId = false
/*IF USER IS CLICKING THE MENU MANY TIMES LIKE ONE TIME IS NOT ENUF*/
var userIsADick = true

function leftMenu(id) {
  $('#'+id).show()
  /*HIDING THE LAST MENU*/
  if(lastMenuId) $('#'+lastMenuId).hide()
  /*IF THE LAST MENUID IS THE SAME ID AS THE CURRENT ONE THEN CHEKING WHAT TO DO*/
  if(lastMenuId == id) {
    /*IF USERISADICK == TRUE MEANS THAT IT'S THE SECOND TIME THE MENU BEEN CLICKED SO THE DICK USER ACUALLY WANT TO CLOSE IT*/
    if(userIsADick) {
      $('#'+lastMenuId).hide()
      userIsADick = false      
    }else { /*ELSE THE OPASITE*/
      userIsADick = true
      $('#'+lastMenuId).show()
    }    
  }else {
    userIsADick = true
  }  
  lastMenuId = id  
  
}

function contact() {
  /*GET ALL THE DATA FROM THE FROM AND TRASLATE IS TO POSTS*/
  var posts = setPost('contact')
  /*REPLACE THE  CONTACTFORM  DIV WIDTH  THE CONTACT.AJAX  WIDTH THE POST DATA */
  ajax('/contact.ajax', posts, '', 'contactForm', 'loading')
}

function setAcive(id, trace) {
  /*TAKES ALL THE ELEMENT AND RESET THEM TO THE DEFUALT CLASS*/
  $(trace).attr('className', 'none')
  /*CHANGE THE CLICKED ANCORE CLASSNAME TO ACTIVE SO IT WILL ADD THE ARROW AND THE BOLD FONT */
  $(id).attr('className', 'active')  
}

function switchNews(num) {
  ajax3('/frontNews.ajax', 'num='+num, '', 'frontNews', '')
  if(num == 8)var newNum = 0
  else var newNum = parseInt(num) + 1
  setTimeout("switchNews('"+newNum+"')", 3000);
}

function showFlag(id){
  //$('.map-image .hide').hide()
  $(id).show()
}


function savePdf(file){
//open the pdf File
	myTempWindow = window.open('/'+file,'','left=100,screenX=100');
	myTempWindow.focus();
}

function showMe(){

}

/*printing the iframe pdf*/
function printPdf(){
	productpdf.window.print();
}
/*
function markPath(selector){
	$('.level a').css('background', '#FFF')
	//$(selector).css('background', '#EEE')
	$(selector).parent().children('a').css('background', '#EEE')
	$(selector).parent().parent().parent().children('a').css('background', '#EEE')
	$(selector).parent().parent().parent().parent().parent().children('a').css('background', '#EEE')
}
*/
function serachItem(){
	var value_to_search=document.getElementById("search_input").value;

	window.location="/search/node/"+value_to_search;

}


function openfarther()
{
	window.location="/about";

}
function openwaranty(){
window.location="/warranty";
}

function Openterms(){
window.location="/terms";
}
