





//this function renders a div with a specific height
function renderDiv(height)
{
	document.write("<div style=\"height:"+ height +"px; font-size: 1px;\"></div>");
}
//end of function





$(document).ready(function() {
  
 // $(".sub").hide();
  $("#main-mask").addClass("js");
  //Get OS
  var os = navigator.platform;
  if(os.toLowerCase().search("mac") > -1) {
    $("body").addClass("mac");
  }
  

	
	//up scrolling
	$(".jumpup").click(function() {
	  attrHref = $(this).attr("href");
	  if (attrHref == "#main") { goTop = 0; } else { goTop = 2200; }
    $(attrHref).show();
    
    $("#main-scroll").animate({ top: goTop }, 3000, "expoinout", function(){
      //callback animation is done
      if (goTop == 0) { 
        $(".sub").hide();
        
      }
    });
		return false;
	});
	
});// end doc ready


function updateOffset(next,thumbs) {
	if(next == 1) {
		if (x == (0 - ((thumbs - thumbsVis) * thumbWidth))) {
			x = 0;
		} else {
			x = x - (thumbWidth*thumbsVis);
		}
	}
	if(x <= 0 && next != 1) {
		if (x == 0) {
			x = (0 - ((thumbs - thumbsVis) * thumbWidth));
		} else {
			x = x + (thumbWidth*thumbsVis);
		}
	}
	
}// end updateOffset

/* AJAX function begins  */


function createXMLHttpRequest() {
    try {return new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {}
    try {return new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}
    try {return new XMLHttpRequest();} catch(e) {}
    return null;
}//end of function 

function postAndFetchXml(url, content, handler) 
{
   
	
	var xmlhttp = createXMLHttpRequest();
	if (xmlhttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

   xmlhttp.onreadystatechange = function() 
   {
        
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            handler(xmlhttp.responseXML);
        }
    };
	//alert(url);
	//alert(content);

    xmlhttp.open('POST', url);	
    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlhttp.send(content);
	
}//end of function 


function postAndFetch(url, content, handler, area_id) 
{
	
	var xmlhttp = createXMLHttpRequest();
	if (xmlhttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

   if(area_id != "")
   {
   		var indicator = document.getElementById(area_id);
		indicator.innerHTML="<div><img src='images/indicator.gif'></div>";
   }
   xmlhttp.onreadystatechange = function() 
   {
        
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
		{
            handler(xmlhttp.responseText, area_id);
        }
    };

    xmlhttp.open('POST', url, true);	
    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlhttp.send(content);
	
}//end of function 

function postAndFetchForm(url, formId, handler, area_id) 
{
	
	var xmlhttp = createXMLHttpRequest();
	if (xmlhttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	
	content = ""
	//grab all the element value of this document
	var x=document.getElementById(formId);
	for (var i=0;i<x.length;i++)
  	{
  		if(i == 0)
			content =  x.elements[i].name + "=" +  x.elements[i].value ;
  		else
			content += "&" + x.elements[i].name + "=" +  x.elements[i].value ;
		
  	}

   
   var indicator = document.getElementById(area_id);
	indicator.innerHTML="<div><img src='images/indicator.gif'></div>";
   
   xmlhttp.onreadystatechange = function() 
   {
        
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
		{
            handler(xmlhttp.responseText, area_id);
        }
    };

    xmlhttp.open('POST', url, true);	
    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlhttp.send(content);
	
}//end of function 


function generalHandler(Text, area_id)
{
	
	//alert(Text);
	var str= Text;
	
	var content = Text
	//alert(holder);
	
	if(area_id != "")
	{
		var updateform = document.getElementById(area_id);
		   updateform.innerHTML=content;
	}
	

		
}//end of function




