bottomHeight=0;
function ShowBL(){
BLstatus=document.getElementById('BusinessLines').style.display;
if (BLstatus=="block"){
	document.getElementById('BusinessLines').style.display="none";
	document.getElementById('BLarrow').src="images/ArrowBusinessLine.gif";
	document.getElementById('btnView').src="images/btnView.gif";
	}
else{
	document.getElementById('BusinessLines').style.display="block"
	document.getElementById('BLarrow').src="images/ArrowBusinessLineS.gif"
	document.getElementById('btnView').src="images/spacer.gif";
	}
}
 
function setHeight(id) {
  if ( document.getElementById('topTable') != null  ) {
  	   document.getElementById('topTable').style.height=id; 
  }
  window.document["topa"].setAttribute('height',id)
}
function openHistory(id) {
	HistallSomme=document.getElementById('counterHistory').value;
	for (i=1;i<=HistallSomme;i++){
		 if (id != i ) {
			Hide("historyLine"+i);
 		    	
		}
	}
 	Show("historyLine"+id); 
}


function ShowThis(id) {
	countSpeed=document.getElementById('counterSpeed').value;
 	for (i=1;i<=countSpeed;i++){
		 if (id != i ) {
			Hide("conversionSub"+i);
			document.getElementById('arrowMenuProduct'+i).className="arrowmenu3" 
		    	
		}
	}
	if (document.getElementById("conversionSub"+id).style.display =='none') {
	Show("conversionSub"+id);
	document.getElementById('arrowMenuProduct'+id).className="arrowmenu1";
    document.getElementById('centerTable').style.height=parseInt(document.getElementById('centerTable').offsetHeight)+parseInt(document.getElementById("conversionSub"+id).offsetHeight)+"px";
	}
	else {
	Hide("conversionSub"+id);
	document.getElementById('arrowMenuProduct'+id).className="arrowmenu3"
	}
}
function showAllPower(){
	counterSpeed1=document.getElementById('counterSpeed').value;
	for (i=1;i<=counterSpeed1;i++){
				Hide("conversionSub"+i);	
	}
}
function Show(id) {
	document.getElementById(id).style.display='block';	 	
}
function Hide(id) {
	document.getElementById(id).style.display='none';	 	
}

function showPage1() {
	document.getElementById('divDrag1').style.display='block';	 
}
function HidePage1() {
	document.getElementById('divDrag1').style.display= 'none';	
}

function showPage2() {
	document.getElementById('divDrag2').style.display='block';	 
}
function HidePage2() {
	document.getElementById('divDrag2').style.display= 'none';	
}
function openNewsLetter() {
	document.FormLetter.reset();  //this line to delete all data entered if we opened it another time.it will clear all fields in elements entered.
	document.getElementById('sendMessage').innerHTML="";
  	document.getElementById('divDrag2').style.height=document.getElementById('centerTable').offsetHeight+bottomHeight+"px";   //27 px height of the bottom div
	showPage2();
}


function openContact() {
    document.FromContact.reset();  //this line to delete all data entered if we opened it another time.it will clear all fields in elements entered.
	document.getElementById('sendContact').innerHTML="";
	
	
   	document.getElementById('divDrag1').style.height=document.getElementById('centerTable').offsetHeight+bottomHeight+"px";   //27 px height of the bottom div
	showPage1();
}
function saveContact() {
	contentObj=document.getElementById('insertNws');
	contactName1=document.getElementById('letterContact').value;
	phoneNumber1=document.getElementById('phonenumberContact').value;
	mobileNumber1=document.getElementById('mobileNumberContact').value;
	emailContact1=document.getElementById('emailLetterContact').value;
	country1=document.getElementById('countryLetterContact').value;
	Message1=document.getElementById('messageContact').value;
	messageQuery="";
     
	AtPos = emailContact1.indexOf("@")
	StopPos = emailContact1.lastIndexOf(".")
	if (AtPos == -1 || StopPos == -1) {
		if (messageQuery.length == 0) messageQuery = messageQuery + "The following error(s) occurred:\n";
		messageQuery = messageQuery + "valid Billing email Address\n";
	}
	if (contactName1 == "" ) {
		if (messageQuery.length == 0) messageQuery = messageQuery + "The following error(s) occurred:\n";	
		messageQuery = messageQuery + "Contact Name is required. \n";
	}
	if (country1 == "" ) {
		if (messageQuery.length == 0) messageQuery = messageQuery + "The following error(s) occurred:\n";	
		messageQuery = messageQuery + "country is required.\n";
	}
	if (Message1 == "" ) {
		if (messageQuery.length == 0) messageQuery = messageQuery + "The following error(s) occurred:\n";	
		messageQuery = messageQuery + "Message is required.\n";
	}
	if (messageQuery == "") {
		var poststr = "contactName="+encodeURI(contactName1)+"&phoneNumber="+encodeURI(phoneNumber1)+"&mobileNumber="+encodeURI(mobileNumber1)+"&emailContact="+encodeURI(emailContact1)+"&Message="+encodeURI(Message1)+"&country="+encodeURI(country1);
		postAjaxFile("send-Contact.asp",poststr);
	}
	else {
		alert(messageQuery);
	}
}


function saveNewsLetter() {
	contentObj=document.getElementById('insertNws');
	lettername1=document.getElementById('namePersont').value;
	mobileNumber1=document.getElementById('mobileNumber').value;
	phonenumber1=document.getElementById('phonenumber').value;
	emailLetter1=document.getElementById('emailLetter').value;
	countryLetter1=document.getElementById('countryLetter').value;
	
	messageQuery=""; 
	AtPos = emailLetter1.indexOf("@")
	StopPos = emailLetter1.lastIndexOf(".")
	if (AtPos == -1 || StopPos == -1) {
		if (messageQuery.length == 0) messageQuery = messageQuery + "The following error(s) occurred:\n";
		messageQuery = messageQuery + "valid Billing email Address\n";
	}
	
	if (lettername1 == "" ) {
		if (messageQuery.length == 0) messageQuery = messageQuery + "The following error(s) occurred:\n";	
		messageQuery = messageQuery + "Name is required. \n";
	}
	if (phonenumber1 == "" ) {
		if (messageQuery.length == 0) messageQuery = messageQuery + "The following error(s) occurred:\n";	
		messageQuery = messageQuery + "Phone Number is required. \n";
	}
	if (countryLetter1 == "" ) {
		if (messageQuery.length == 0) messageQuery = messageQuery + "The following error(s) occurred:\n";	
		messageQuery = messageQuery + "Country is required. \n";
	}
	if (messageQuery == "" ) {
		var poststr = "name="+encodeURI(lettername1)+"&mobile="+encodeURI(mobileNumber1)+"&phone="+encodeURI(phonenumber1)+"&email="+encodeURI(emailLetter1)+"&countryLetter="+encodeURI(countryLetter1);
		postAjaxFile("saveNewsLetter.asp",poststr);
	}
	else {
		alert(messageQuery)
	}
}
function CreateHttpObject() { 
	var objXMLHttp=null
	try {
		objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
    } 
	catch (e) {
			try {
				objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (err) {
				objXMLHttp = null;
			}
    }
	if(!objXMLHttp && typeof XMLHttpRequest != "undefined")
		objXMLHttp = new XMLHttpRequest();
return objXMLHttp
}

function postAjaxFile(urlPage,parameters) {
	xmlHttpPost=CreateHttpObject()
	if (xmlHttpPost==null) {
		alert ("Browser does not support HTTP Request")
		return
	} 
	xmlHttpPost.onreadystatechange=stateChangedPost
	xmlHttpPost.open("POST",urlPage,true);
	xmlHttpPost.setRequestHeader("Content-type", "application/x-www-form-urlencoded");   
	//alert(parameters)
	xmlHttpPost.setRequestHeader("Content-length", parameters .length);   
	xmlHttpPost.setRequestHeader("Connection", "close"); 
	xmlHttpPost.send(parameters)
	
}

function stateChangedPost() { 
	if (xmlHttpPost.readyState==4 || xmlHttpPost.readyState=="complete") { 
	    contentObj.innerHTML=xmlHttpPost.responseText;
		closePopup();
	 } 
} 

function closePopup() {
    resultInsert1=document.getElementById('resultInsert').value;
    if (resultInsert1 == "" ) {
	    document.getElementById('sendMessage').innerHTML="Your Email has been sent."; 
		document.getElementById('sendContact').innerHTML="Your Email has been sent."; 
	    setTimeout("HidePage2();",3000);
		setTimeout("HidePage1();",3000);
   }
   else {
		document.getElementById('sendMessage').innerHTML="This Mail Already Exist.Please Enter Another one.";
   }
}
function openContactMenu(id) {
	for (i=1;i<=3;i++) {
		if (i != id )
		document.getElementById('content'+i).style.display="none";
		switchImage("arrowImg"+i,'images/flcheGriscontact.png');
		document.getElementById('LabelContact'+i).className="labelLabelContact2";
 	}
	document.getElementById('content'+id).style.display="block";
	switchImage("arrowImg"+id,'images/arrowDownContact.png');
	document.getElementById('LabelContact'+id).className="labelLabelContact1";	
}
function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}
function openProductMenu(id) {
	if (id == "1" ) {
	   document.getElementById('myMenuProduct1').className="productMenu1";
	   switchImage("productImg",'images/TabProducts.gif');
	   document.getElementById('myMenuProduct2').className="solutionMenu1";
	   switchImage("solutionImg",'images/TabSolutions.gif');
	   document.getElementById('productMenu').style.display="block";
	   document.getElementById('solutionMenu').style.display="none";
	}
	if (id == "3" ) {
	   document.getElementById('myMenuProduct1').className="LeftTabProductR";
	   switchImage("productImg",'images/TabProductsN.gif');
	   document.getElementById('myMenuProduct2').className="LeftTabSolutionG";
	   switchImage("solutionImg",'images/NTabSolutionsS.gif');
	   document.getElementById('productMenu').style.display="none";
	   document.getElementById('solutionMenu').style.display="block";
	}
	if (id == "4" ) {
	  document.getElementById('myMenuProduct1').className="LeftTabProduct";
	   switchImage("productImg",'images/TabProducts.gif');
	   document.getElementById('myMenuProduct2').className="LeftTabSolution";
	   switchImage("solutionImg",'images/TabSolutions.gif');
	   document.getElementById('productMenu').style.display="block";
	   document.getElementById('solutionMenu').style.display="none";
	}
	if (id == "2" ) {
	   document.getElementById('myMenuProduct1').className="productMenu2";
	   switchImage("productImg",'images/TabProductsU.gif');
	   document.getElementById('myMenuProduct2').className="solutionMenu2";
	   switchImage("solutionImg",'images/TabSolutionsS.gif');
	   document.getElementById('solutionMenu').style.display="block";	
	   document.getElementById('productMenu').style.display="none";
}
}
