empty = function(txtid) {
	document.getElementById(txtid).value = "";	
}

findcat = function(val)
{
	var url;
	url="fetch.php?val="+val;
	var xmlHttp;
	try {  
	// Firefox, Opera 8.0+, Safari 
		 xmlHttp=new XMLHttpRequest();  
	}
	catch (e){ 
	 // Internet Explorer  
		try	{    
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
		}
		catch (e){    
			try	{     	
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
			}
			 catch (e) {      
				  alert("Your browser does not support AJAX!");
				  return flase;
			 }
		}
	  }
	  xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4){
			document.getElementById('findcat').innerHTML=xmlHttp.responseText; 
		}
	  }
	  xmlHttp.open("Get",url,true);
	  xmlHttp.send(null);
}

/*******************************************************************************************************************
********************************************************************************************************************
function name 		:: 	tooltip
function paramter 	::	product id
Description			::	This will help to display short desc, description of product will come from DB using AJAX. 

********************************************************************************************************************
*******************************************************************************************************************/

//window.onload = init;
var tempx;
var tempy;
var final;
var div = document.getElementById('Tipss');

displayTip = function(id) {
	var div = document.getElementById('Tipss');
	div.style.display = "block";
}

hideTip = function() {
		var div = document.getElementById('Tipss');
		div.style.display = "none";
}

function init(){

  if (window.Event) {
	if (navigator.appName == "Microsoft Internet Explorer") 
		document.captureMousePosition;
	else
	    document.captureEvents(Event.MOUSEMOVE);
  }
  document.onmousemove = getXY;
}

function getXY(e) {
	  tempx = (window.Event) ? e.pageX : event.clientX;
	  tempy = (window.Event) ? e.pageY : event.clientY;
	  document.getElementById('Tipss').style.left = tempx + 8 + 'px';
	  document.getElementById('Tipss').style.top = tempy + 8 + 'px';
}



/*******************************************************************************************************************
********************************************************************************************************************
function name 		::  imgswap
function paramter 	::	Image name
Description			::	This will help us to swap product images

********************************************************************************************************************
*******************************************************************************************************************/

imgswap = function (src, imgid, color)
{
	//alert(color);
	//document.getElementById("imgColors").value = color;
	document.getElementById(imgid).src = "tempex/album/images/"+src;
}


/*******************************************************************************************************************
********************************************************************************************************************
function name 		::  validate (Contact Us)
function paramter 	::	field ID
Description			::	This will help us to swap validate images

********************************************************************************************************************
*******************************************************************************************************************/

validate = function(id, cntr) {
	var eid = "e" + id;
	var val = document.getElementById(id).value;
	var alphaExp = /^[a-zA-Z]+$/;
	var cond = "errCon"+cntr;
	//var s = document.getElementById(cond).value;
	
	
	document.getElementById(eid).style.display = "block";
	if(id != "txtFromEmail") {
		if(val == "") {
			document.getElementById(cond).value = 0;
			document.getElementById(eid).src = "images/no.gif";
			document.getElementById(id).focus();
		}
		else if(id == "txtFromName" || id=="txtFromCompany") {
			if(!(document.getElementById(id).value.match(alphaExp))) {
				document.getElementById(cond).value = 0;
				document.getElementById(eid).src = "images/no.gif";
				document.getElementById(id).focus();
			}
			else {
				document.getElementById(cond).value = 1;
				document.getElementById(eid).src = "images/yes.gif";
			}
		}
		else if(id == "txtFromTel" || id == "txtFromFax") {
			var alphaExp = /^[0-9-+()]+$/;
			var len = val.length;
			if(!(document.getElementById(id).value.match(alphaExp))) {
				document.getElementById(cond).value = 0;
				document.getElementById(eid).src = "images/no.gif";
				document.getElementById(id).focus();
			}
			else {
				if((len > 5) && (len < 15)) {
					document.getElementById(cond).value = 1;
					document.getElementById(eid).src = "images/yes.gif";
					return;
				}
				else {
					document.getElementById(cond).value = 0;
					document.getElementById(eid).src = "images/no.gif";
					document.getElementById(id).focus();
					return;
				}
					
			}
		}
		else {
			document.getElementById(cond).value = 1;
			document.getElementById(eid).src = "images/yes.gif";
		}
	} else {
				if(document.getElementById(id).value.indexOf("@")==-1 ||document.getElementById(id).value.indexOf(".")==-1 || document.getElementById(id).value.indexOf("")==-1 ) {
					document.getElementById(cond).value = 0;
					document.getElementById(eid).src = "images/no.gif";
					document.getElementById(id).focus();
			    }
				else {
					document.getElementById(cond).value = 1;
					document.getElementById(eid).src = "images/yes.gif";
				}
	}
}

/*******************************************************************************************************************
********************************************************************************************************************
function name 		::  contact()
function paramter 	::	NO
Description			::	This will help us to check form validation before submitting.

********************************************************************************************************************
*******************************************************************************************************************/

contact = function() {

	var count=0;
	while(count++ < 7) {
		var cond = "errCon"+count;
		if(document.getElementById(cond).value == "0") 
			return false;
	}
	return true;
}

function success() {

	var txt='Your Feedback had successfully send !!!!<br> We will contact you back soon.';
	$.prompt(txt);	
}
function errmsgno() {

	var txt='Please Enter the valid code!!!' ;
	$.prompt(txt);	
}

function memsuccess() {

	var txt='Your Membeship request had successfully send !!!!<br> We will contact you back soon.' ;
	$.prompt(txt);
}

