// JavaScript Document
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s

	 

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  return true
}

function showImage(mode,imgsrc)
{
	imglinkobj = document.getElementById("imglink");
	imglinkobj.style.top = (tempY - 20) + "px";
	imglinkobj.style.left = (tempX + 250) + "px";
	if(mode == 1)
	{
		imglinkobj.style.display = "block";
		imglinkobj.src = imgsrc;
	}
	else if(mode == 0)
		imglinkobj.style.display = "none";
}

function switchmenu(objimg,mode)
{
	//alert(objimg.src);
	
	if(mode == 1)
	{
		//splitstr = objimg.src.split(".");
		//objimg.src = splitstr[0]+"_h.jpg";
		tempstr = objimg.src.replace(".jpg","");
		//alert(tempstr);
		objimg.src = tempstr+"_h.jpg";
	}
	else if(mode == 2)
	{
		//splitstr = objimg.src.split("_");		
		tempstr = objimg.src.replace("_h.jpg","");
		//objimg.src = splitstr[0]+".jpg";
		objimg.src = tempstr+".jpg";
	}
	
}

function switchimage(img)
{
	document.getElementById("previewimg").src = img;
}

function check_contact(){
var obj=document.form1;
var msg=''; 
 if(obj.name.value==''){
    msg=msg + ' - Please fill the Name field';
 }
  if(obj.email.value==''){
    msg=msg + '\n- Please fill the Email field';
 }else{
	 if(!checkemail(obj.email.value))
	  msg=msg + '\n- Please fill the Email field with valid email';
	 }  
 if(obj.phone.value==''){
    msg=msg + '\n - Please fill the Phone field';
 }
 if(obj.comment.value==''){
    msg=msg + '\n - Please fill Your Comment';
 }
 if(msg != ""){
		window.alert(msg) ;
	}else{
   obj.action="Contact_Us_2.php";		
   obj.submit();
   //return true;
 };	
}
function checkemail(string){
var str=string;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
	else{
	//alert("Please input a valid email address!")
	testresults=false
	}
return (testresults)
}
