
///// flash preloader

function preloader(imgfile){


  var img = new Image();
  
  // wrap our new image in jQuery, then:
  $(img)
    // once the image has loaded, execute this code
    .load(function () {
      // set the image hidden by default    
      $(this).hide();
    
      // with the holding div #loader, apply:
      $('#loader')
        // remove the loading class (so no background spinner), 
        .removeClass('loading')
        // then insert our image
        .append(this);
    
      // fade our image in to create a nice effect
      $(this).fadeIn();
    })
    
    // if there was an error loading the image, react accordingly
    .error(function () {
      // notify the user that the image could not be loaded
    })
    
    // *finally*, set the src attribute of the new image to our image
    .attr('src', 'uploads/anim/'+imgfile);


}
					 function form_callback(str){

						 document.getElementById("callback").innerHTML=str;
						 
					}
					 
					 function talktoform_submit()
					{  
						
						var name = document.getElementById("callback_name").value;
						var number = document.getElementById("callback_number").value;
													
						var poststr = 'name=' + escape(name)+'&number='+ escape(number);
						
						makePOSTRequest("callback_ajax.php", poststr, form_callback);
						
					 }
					 
					 
					  function survey_callback(str){

						if(str.indexOf('.html')>0)
						{
								window.location=str;
								
						}else{
						 document.getElementById("survey_ajax").innerHTML=str;
						}
					}
					 
					 function survey_display(questionid, survey_id)
					{  
					
					var result ="";
						if(questionid>0)
						{
						
						 if (eval("document.surveyform.question_" + (questionid-1) + "[0].checked") == true)
						 {
							result="yes";
						 }else if (eval("document.surveyform.question_" + (questionid-1) + "[1].checked") == true)
						 {
							 result="no";
						 }else{
							 questionid=questionid-1;
						 }
				
						}
						var poststr = 'question=' + escape(questionid)+'&value='+ escape(result)+'&id='+ escape(survey_id);
						
						makePOSTRequest("survey_ajax.php", poststr, survey_callback);
						
					 }
					 
					 function previous_display(questionid, survey_id)
					{  
					
					
						
						var poststr = 'question=' + escape(questionid)+'id='+ escape(survey_id);
						
						makePOSTRequest("survey_ajax.php", poststr, survey_callback);
						
					 }
					 
					 
				function hideDiv(div)
				{ 
					document.getElementById(div).style.display="none";
					
				}
				
				function showDiv(div)
				{ 
					document.getElementById(div).style.display="block";
					
				}
				
				
					 
			function ClearInput(x, thetext)
			{
				
				// Only Clear box if it has <no subject>
				inputstring = document.getElementById(x).value;
				if (inputstring==thetext)
				{
					document.getElementById(x).value='';
				}
			}

			function ValidateInput(x, thetext)
			{
				// If the box is empty put back <no subject>
				inputstring = document.getElementById(x).value;
				if (inputstring=='')
				{
					document.getElementById(x).value=thetext;
				}
			}
					 
			
			
$(document).ready(function() {
						   
	$("#answer a").mouseover(function(){
								   
			imgsrc = $(this).children("img").attr("src");
			if(imgsrc)
			{
				matches = imgsrc.match(/_over/);
				if (!matches) {
					imgsrcON = imgsrc.replace(/.png$/ig,"_over.png");
					$(this).children("img").attr("src", imgsrcON);
				}
			}
	});
	$("#answer a").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});
	
	$("#answer img").each(function() {
	rollsrc = $(this).attr("src");
	rollON = rollsrc.replace(/.png$/ig,"_over.png");
	$("<img>").attr("src", rollON);
	
	
	if (document.images)
    {
      preload_image_object = new Image();
      // set image url
      image_url = new Array();
      image_url[0] = "/images/blue_blank.png";
      image_url[1] = "/images/purpleLayout.png";
      image_url[2] = "/images/greenLayout.png";

       var i = 0;
       for(i=0; i<=3; i++) 
         preload_image_object.src = image_url[i];
    }
	
});
	
	//// logo scroller

	
		
	//accordian people
	 $(document).ready(function() {
								
								
	$('#clientsticker').innerfade({ animationtype: 'slide', speed: 750, timeout: 2000, type: 'sequence' }); 
								
								
   
  });


	
	



	
});
	
	function revealpeople(div) {
		
		$('.cell_textlarge').hide('slow');
		$('.morelink').show('slow');
		
		if(document.getElementById('large_'+div).style.display=='block')
		{
			$('#large_'+div).hide('slow');
			$('#more_'+div).show('slow');
		}else{
			$('#more_'+div).hide('slow');
			$('#large_'+div).show('slow');
		}
		
	}		
					 
					 
function makePOSTRequest(url, parameters, cb)
{
	http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 http_request = new XMLHttpRequest();
	 if (http_request.overrideMimeType) {
		// set type accordingly to anticipated content type
		//http_request.overrideMimeType('text/xml');
		http_request.overrideMimeType('text/html');
	 }
	} else if (window.ActiveXObject) { // IE
	 try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
		try {
		   http_request = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {}
	 }
	}
	if (!http_request) {
	 alert('Cannot create XMLHTTP instance');
	 return false;
	}

	http_request.onreadystatechange = function()
    {
      if(http_request.readyState==4)
	  	{
			cb(http_request.responseText);
        }
      };
	http_request.open('POST', url, true);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", parameters.length);
	http_request.setRequestHeader("Connection", "close");
	http_request.send(parameters);
}

