﻿function validateContactForm()
{
    var errMsg = '';
    
    alert('test');
    
    if(errMsg != '')
    {
        return false;
    }else
    {
        return true;
    }
}

function doClick(buttonName,e)
{
    //the purpose of this function is to allow the enter key to 
    //point to the correct button to click.
    var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

    if (key == 13)
    {
        //Get the button the user wants to have clicked
        var btn = document.getElementById(buttonName);
        if (btn != null)
        { //If we find the button click it
            btn.click();
            event.keyCode = 0
        }
    }
}

function showmoreinfosearch(url,divId,searchInputId,catId)
{
	//alert(divId);
	//getMouseXY();
	//document.getElementById('test1').style.top=tempY-50;
	//document.getElementById('test1').style.left=tempX+20;
	//document.getElementById('test1').style.display="block";
    document.getElementById('txtqid').value = '0';
	
	if(searchInputId != '')
	{
	    searchCriteria = document.getElementById(searchInputId).value;
	}
	url += '?cat='+catId+'&sc='+searchCriteria;
    //alert(url);
    eval("loadXMLDoc('"+url+"','"+divId+"')");
}

var req;
var el;
function loadXMLDoc(url,e) {
	req = false;
	el = e;

    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {

    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {

       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
        
	if(req) {
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send("");
	}
}

function processReqChange() {
//alert(req.readyState);
    // only if req shows "loaded"
    if (req.readyState == 1)
	{
		//document.getElementById(el).innerHTML="<img src='http://www.destinationvenus.co.uk/admin/images/lightboximages/loading.gif'>"
		//document.getElementById(el).innerHTML="<img src='/images/loading.gif'><br />Loading..."
		
		//document.getElementById(el).innerHTML="Loading..."
		
		//You could put a Image here if you wanted
	}
	if (req.readyState == 4)
	{
        // only if "OK"
		document.getElementById(el).innerHTML=req.responseText
        if (req.status == 200) {
            // ...processing statements go here...
        } else {
            //document.getElementById(el).innerHTML= "There was a problem retrieving the XML data:\n" + req.statusText;
            document.getElementById(el).innerHTML= "There was a problem retrieving the data:\n" + req.statusText;
        }
    }

}

function setSearchbox(textBoxVal,myId)
{
    document.getElementById('txtask').value = textBoxVal;
    document.getElementById('txtqid').value = myId;
    document.getElementById('search_suggest').innerHTML = '';
}

function checkQuestionAsked()
{
	if (document.getElementById('txtask').value == '')
	{
		alert("Please enter a question!");
		return false;
	}
}