// JavaScript Document

oldscnavitop =0;
newscnavitop =0;
$(document).scroll(function() {
	oldscnavitop = newscnavitop;	
	winh = $(window).height();
	navtp =  ((winh - 80) / 2);	
	maxht = $(document).height() - 410;
	
	newscnavitop = ($(document).scrollTop() + navtp);	
	if((oldscnavitop >= 556 && newscnavitop < 556) || (oldscnavitop < maxht && newscnavitop >= maxht)){
		$('#scrollnavi').stop().animate({'opacity':0},400);
	}	
	if((newscnavitop >= 556 && oldscnavitop < 556) || (oldscnavitop >= maxht && newscnavitop < maxht)){
		$('#scrollnavi').stop().animate({'opacity':1},400);
	}
	if(newscnavitop <526) newscnavitop = 526;	
	if(newscnavitop > maxht) newscnavitop = maxht;		
	
	$('#scnavibox').stop().animate({'top':newscnavitop},800);
});

$(document).ready(function() { 
	$('#scrollnavi').stop().css({'opacity':0});

	$('#scnavitop').click(function(){
		winh = $(window).height();		
		sctop = $(document).scrollTop();
		sctop -= (winh / 2);		
		if(sctop<50) sctop = 0;		
		$('html,body').animate({'scrollTop':sctop},800);
	});
	
	
	$('#scnavibottom').click(function(){
		winh = $(window).height();
		sctop = $(document).scrollTop();
		sctop += (winh / 2);		
		if(sctop > $(document).height()) sctop = $(document).height();
		$('html,body').animate({'scrollTop':sctop},800);
	});
});

//Map

//<![CDATA[

function load() {
if (GBrowserIsCompatible()) {


         var map = new GMap2(document.getElementById("map"));
         map.addControl(new GLargeMapControl());
         var MapTypes = map.getMapTypes();
       
         map.addControl(new GMapTypeControl());
         map.setCenter(new GLatLng(12.249954918111673, 79.07138764858246), 12);
         var info='<div style="background-color: #fff; width: 200px; font-size: 11px; FONT-FAMILY: Verdana, Tahoma, Arial, Sans-Serif;"><B>Webtrendz</B><hr>No:1547 K Suresh Complex <hr> Thendral Nagar, Tiruvannamalai <hr> Tamilnadu - India - 606603 </div>';
         var point = new GLatLng(12.249954918111673, 79.07138764858246);
         var marker = new GMarker(point);
         GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(info);
         });
        map.addOverlay(marker);
         marker.openInfoWindowHtml(info);     

}
}

//]]>
