<!--//

/* used for showing / hiding divs by class 
 For this to work the div ID and class must be
 named the same. I.E.: 
 <div id='banner' class='banner'>
 In your CSS script you'll need to create the following class:
 div.banner {display:none;}
 div.banneron{display:block}
 
 Since you cannot have the same ID value on the same page you'll
 need to create more ID's for your CSS script if you're going
 to use this more then once on a page.
 
 <div id='banner1' class='banner1'>
 div.banner1 {display:none;}
 div.banner1on{display:block}
 */
function jshow_hide(div) {
var e = document.getElementById(div);

var clsnm = div;
//alert(e.className);
if(e.className == div) {
e.className = div + "on";
 } else {
e.className = div;
 }

//alert(e.className);
 }
 
 /* this is for contact form. */
	//check characters ...
     function Check_Chars(jbox,x) {
    var max_cars = 2500;
    var chars_left = max_cars - jbox.value.length;
    if(chars_left < 10 && chars_left >= 0) {
    chars_left = '<font color="yellow"><B>' + chars_left + '</B></font>';
    }
    if(chars_left < 0) {
    chars_left = '<font color="red"><B>' + chars_left + '</B></font>';
    $('error_comments').show();
     }
   $('chars_left').innerHTML = chars_left;
    }
	function chk_subject(subjct) {
	if(subjct == "other") {
	$('other_subject_dsp').show();
	  } else {
	 $('other_subject_dsp').hide();
	  }
	 }
	 
	 function send_mail(frmnme) {
 var formlength = frmnme.length;
 var pars = $(frmnme).serialize();
 var url = '/contact/contact.php';
 //alert($('fadeintothewind').visible());
 var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: pars, onCreate: function(){
			$('rresults').innerHTML = '<img src="/images/ajax-loader.gif">';
			$('fadeintothewind').show();
			$('rresults').show();
		},onComplete: show_response}
    );
  }
  function show_response(request) {
    
      var elt = $('rresults');
	   
      // retrieve required dimensions
      var eltDims = elt.getDimensions();
      var browserDims = $(document.body).getDimensions();
	  
      // calculate the center of the page using the browser and element dimensions
      var y = (browserDims.height - eltDims.height) / 2;
      var x = (browserDims.width - eltDims.width) / 2;
      // set the style of the element so it is centered
      var styles = { position : 'absolute',
      top : y + 'px',
      left : x + 'px' };
      elt.setStyle(styles);
      elt.scrollTo(); 
  // var x = document.body.scrollTop;
  // var y = document.body.scrollLeft;
   //document.getElementById(div).style.top = (x + -100) + "px";
  //$('rresults').style.top = (x + 300) + "px";
  //$('rresults').style.left = (y + 300) + "px";
  
  $('rresults').innerHTML = request.responseText;
  Effect.BlindDown('rresults');
  //$('fadeintothewind').hide();
   }
   
   function clear_results(){
   $('rresults').innerHTML = "";
   $('rresults').hide();
    }

    function close_win() {
	Effect.BlindUp('rresults');
	$('fadeintothewind').hide();
	 }
	 

//-->
