var flag=1;
var flag1=1;
function checkfriend(){
	str=document.getElementById("emailfriend").value;
		
	if ((str.indexOf(".") < 2) || (str.indexOf("@") < 0)){
				alert('Invalid email address');
			}
		
		else{
			  xmlhttp=GetXmlHttpObject();
			   if (xmlhttp==null)
			  {
				 alert ("Your browser does not support AJAX!");
			  return;
			  }
			
			  
			   var url="friend.asp?emailfriend="+document.getElementById('emailfriend').value;
			
			
				xmlhttp.onreadystatechange=stateChanged;
				xmlhttp.open("GET",url,true);
				xmlhttp.send(null);
				}
	
function stateChanged()
					{
					if (xmlhttp.readyState==4)
					  {
					 alert("sent to your friend");
					  
					
					  
					  }
					}
	
	
function GetXmlHttpObject()
					{
					if (window.XMLHttpRequest)
					  {
					  // code for IE7+, Firefox, Chrome, Opera, Safari
					  return new XMLHttpRequest();
					  }
					if (window.ActiveXObject)
					  {
					  // code for IE6, IE5
					  return new ActiveXObject("Microsoft.XMLHTTP");
					  }
					return null;
					}		
			
	
}

function erase(){
	document.getElementById("emailfriend").value="";
	
	
	
	
	}


function setbd(){
 var t_w = document.body.clientWidth;
 window.document["detectionExample"].setAttribute('debug', 'false');
 var t_h1 = document.body.clientHeight;
if(t_h1>219)
 window.document["detectionExample"].setAttribute('height', '232');
else
window.document["detectionExample"].setAttribute('height', '100%');

 if(t_w>1200)
 window.document["detectionExample"].setAttribute('width', '100%');
 else
 window.document["detectionExample"].setAttribute('width', '1200');
 t_h=t_h1;
} 
function goto(){
	
	window.open('http://www.eyedigits.com')
	}
function gotoacal(){
	
	window.open('http://www.acal.org.lb')
	}
function showbox(){
	document.getElementById("opacity").style.height=document.getElementById("content").offsetHeight+'px';
	document.getElementById("opacity").style.display='block';
	document.getElementById("contact").style.display='block';
	}
function closebox(){
	document.getElementById("contact").style.display='none';
	document.getElementById("opacity").style.display='none';

	}	
function resetField(){
		document.getElementById("value1").value="";
		document.getElementById("value2").value="";
		document.getElementById("value3").value="";
		document.getElementById("value4").value="";
		document.getElementById("value5").value="";
		document.getElementById("comment").value="";
		document.getElementById("name").value="";
		document.getElementById("location").value="";
		document.getElementById("email").value="";
		document.getElementById("phone").value="";
}
function checkSend(){
	flag=1;
		str=document.getElementById("email").value;	
		if( document.getElementById("value1").value==""||document.getElementById("value2").value==""||document.getElementById("value3").value==""||document.getElementById("value4").value==""||document.getElementById("value5").value==""||document.getElementById("name").value==""||document.getElementById("location").value==""||document.getElementById("email").value==""||document.getElementById("phone").value=="" ){
		alert('Please enter all the required fields');
		flag=0;
		}	
		if ((str.indexOf(".") < 2) || (str.indexOf("@") < 0)){
				alert('Please enter your correct email');
				flag=0;
			}
		
		
		
				 
		if(flag==1)  
		{
			
		 document.getElementById("loader1").style.display='block';
		
			xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }

  
var url="ContactInfo.asp?name="+document.getElementById('name').value+"&value1="+document.getElementById('value1').value+"&value2="+document.getElementById('value2').value+"&value3="+document.getElementById('value3').value+"&value4="+document.getElementById('value4').value+"&value5="+document.getElementById('value5').value+"&email="+document.getElementById('email').value+"&phone="+document.getElementById('phone').value+"&location="+document.getElementById('location').value;

xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
  {
  document.getElementById("loader1").style.display='none';
  
  
  }
}


function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}
			}
			
			
	



function show(id,id1,on,off,a,a1){
	document.getElementById(on).style.display='block';
	document.getElementById(off).style.display='none';
	document.getElementById(id).style.color='#990000';
	document.getElementById(id1).style.color='#233A57';
	}
	
$(document).ready(function(){
  var currentPosition = 0;
  var slideWidth = 520;
  var slides = $('.slide');
  var numberOfSlides = slides.length;

  // Remove scrollbar in JS
  $('#slidesContainer').css('overflow', 'hidden');

  // Wrap all .slides with #slideInner div
  slides
    .wrapAll('<div id="slideInner"></div>')
    // Float left to display horizontally, readjust .slides width
	.css({
      'float' : 'left',
      'width' : slideWidth
    });

  // Set #slideInner width equal to total width of all slides
  $('#slideInner').css('width', slideWidth * numberOfSlides);

  // Insert controls in the DOM
  $('#slideshow')
    .prepend('<span class="control" id="leftControl">Clicking moves left</span>')
    .append('<span class="control" id="rightControl">Clicking moves right</span>');

  // Hide left arrow control on first load
  manageControls(currentPosition);

  // Create event listeners for .controls clicks
  $('.control')
    .bind('click', function(){
    // Determine new position
	currentPosition = ($(this).attr('id')=='rightControl') ? currentPosition+1 : currentPosition-1;
    
	// Hide / show controls
    manageControls(currentPosition);
    // Move slideInner using margin-left
    $('#slideInner').animate({
      'marginLeft' : slideWidth*(-currentPosition)
    });
  });

  // manageControls: Hides and Shows controls depending on currentPosition
  function manageControls(position){
    // Hide left arrow if position is first slide
	if(position==0){ $('#leftControl').hide() } else{ $('#leftControl').show() }
	// Hide right arrow if position is last slide
    if(position==numberOfSlides-1){ $('#rightControl').hide() } else{ $('#rightControl').show() }
  }	
});
function useful(){
	if(document.getElementById("usefulblock1").style.display=='block'){		
			document.getElementById("usefulblock1").style.display='none';
			}
	if(document.getElementById("usefulblock2").style.display=='block'){
			
	    document.getElementById("usefulblock2").style.display='none';
			}
        document.getElementById("usefulblock").style.display='block';
	}
	
	
function exitacal(id){
	document.getElementById(id).style.display='none';	
		}
		
	
function term(){
		if(document.getElementById("usefulblock").style.display=='block'){
			
			document.getElementById("usefulblock").style.display='none';
			}
		if(document.getElementById("usefulblock2").style.display=='block'){
			
			document.getElementById("usefulblock2").style.display='none';
			}
		   document.getElementById("usefulblock1").style.display='block';
		}
function sendto(){
		if(document.getElementById("usefulblock").style.display=='block'){
			
			document.getElementById("usefulblock").style.display='none';
			}
		if(document.getElementById("usefulblock1").style.display=='block'){
			
			document.getElementById("usefulblock1").style.display='none';
			}
		document.getElementById("usefulblock2").style.display='block';
		}
function clear(){
	alert("jasgjasgk");
			document.getElementById("friend").value="";
	}
