// Innerfade Home page banner
	$(document).ready(function(){
				$('ul#banner').innerfade({
				speed: 800,
				timeout: 4000,
				type: 'sequence',
				containerheight: 	'450px',
				slide_timer_on: 	'yes',
				slide_ui_parent: 	'banner'
				});
	});
	
	// Innerfade Home page banner2
	$(document).ready(function(){
				$('ul#banner2').innerfade({
				speed: 800,
				timeout: 4000,
				type: 'sequence',
				containerheight: 	'300px',
				slide_timer_on: 	'yes',
				slide_ui_parent: 	'banner'
				});
	});
// Hover moving effect
	$(document).ready(function() {
			$(".listing_col a").hover(function() {	//On hover...
				$(this).find("span").stop().animate({ 
					marginLeft: "10" //Find the span tag and move it up 40 pixels
				}, 250);
			} , function() { //On hover out...
				$(this).find("span").stop().animate({
					marginLeft: "0" //Move the span back to its original state (0px)
				}, 250);
			});
			
			$(".nav ul li ul li a").hover(function() {	//On hover...
				$(this).find("span").stop().animate({ 
					marginLeft: "10" //Find the span tag and move it up 40 pixels
				}, 250);
			} , function() { //On hover out...
				$(this).find("span").stop().animate({
					marginLeft: "0" //Move the span back to its original state (0px)
				}, 250);
			});
	});

	// Fade loading images
	$(document).ready(function(){
		$(".fade").fadeTo(1, 0);
	});
	
	$(window).load(function(){
		$(".fade").fadeTo("slow", 1);
	});
	
	// Dropdown menu
    $(document).ready(function(){
								   
		$('.nav ul ul').css({display: 'none'});
	
		$('.nav ul li').hover(function(){
			$(this).find('ul:first').css({
				visibility: 'visible',
				display: 'none'
			}).fadeIn('1000');
		},
		function(){
			$(this).find('ul:first').css({
				visibility: 'hidden'
			});
		});
     });
	
	
	
	
	function lookup(inputString) {
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			$.post("includes/rpc.php", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} // lookup
	
	function fill(thisValue) {
		$('#inputString').val(thisValue);
		setTimeout("$('#suggestions').hide();", 200);
	}
	
	
	//User Agent
var ua = new Object();
function setUa(){
	var nav_ua = navigator.userAgent;
	var nav_app = navigator.appName;
	var nav_ver = navigator.appVersion;

	//ua
	ua.dom = document.getElementById;
	ua.omn = nav_ua.indexOf("OmniWeb") != -1;
	ua.n4 = document.layers && !ua.omn;
	ua.opera = window.opera;
	ua.ie = document.all && !ua.opera;
	ua.safari = nav_ua.indexOf("safari",0) != -1;
	ua.gecko = (nav_ua.indexOf("Gecko",0) != -1) && !ua.safari;
	ua.netscape = nav_ua.indexOf("Netscape") != -1;
	ua.firefox = nav_ua.indexOf("Firefox") != -1;

	//os
	ua.mac = nav_ver.indexOf('Mac',0) != -1;
	ua.win = nav_ver.indexOf('Win',0) != -1;
	
	//iever
	var s = nav_ua.indexOf("MSIE ",0) + 5;
	var e = nav_ua.indexOf(";",s);
	ua.iever = nav_ua.substring(s,e);
}
setUa();

//Smooth Scroll//
function smoothScroll(elem,yLastPosition,yTargetPosition) {
	var xScrollSpeed = 1;
	var yScrollSpeed = 1.1;
	
	var y1 = y2 = 0;
	if (document.documentElement) y1 = document.documentElement.scrollTop || 0;
	if (document.body) y2 = document.body.scrollTop || 0;
	var yNow = Math.max(y1, y2);
	
	if(!yLastPosition) yLastPosition = yNow;
	
	var xTarget = yTarget = 0;
	if(!yTargetPosition){
		if(!elem) var elem = "top";
		if(elem.substring(0,7)=="http://"){
			if(elem.indexOf("#")!=-1){
				elem = elem.split("#")[1];
			}else{
				elem = "top";
			}
		}
		
		if(document.getElementById && elem!="top"){
			var obj = document.getElementById(elem);
			if(elem) {
				yTarget = obj.offsetTop;
				while((obj = obj.offsetParent) != null){
					yTarget += obj.offsetTop;
				}
			}
		}
		if(yTarget>getWindowScrollSize().height-getWindowInnerSize().height) {
			yTarget = getWindowScrollSize().height-getWindowInnerSize().height;
		}
	} else {
		yTarget = yTargetPosition;
	}

	var xTempTarget = xTarget;
	var yTempTarget = yTarget;

	if(yTarget>yNow) yTempTarget = Math.ceil( yTarget - ( yTarget - yNow ) / yScrollSpeed );
	if(yTarget<yNow) yTempTarget = Math.floor( ( yNow - yTarget ) / yScrollSpeed + yTarget );
	window.scrollTo(xTempTarget, yTempTarget);
	
	if (yTarget!=yNow && yLastPosition==yNow) {
		var nextFunc = "smoothScroll('" + elem + "'," + yTempTarget + "," + yTarget + ")";
		window.setTimeout(nextFunc, 16);
	}
}


//window inner size
function getWindowInnerSize(){
	var obj = new Object();
	if(document.all || (document.getElementById && ua.ie)){
		obj.width = document.documentElement.clientWidth;
		obj.height = document.documentElement.clientHeight;
	} else if(document.layers || document.getElementById){
		obj.width = window.innerWidth;
		obj.height = window.innerHeight;
	}
	return obj;
}

//window scroll size
function getWindowScrollSize(){
	var obj = new Object();
	obj.width = document.documentElement.scrollWidth;
	obj.height = document.documentElement.scrollHeight;
	return obj;
}

//roll over image
function preloadImg(src){
	if(document.images){
		(new Image()).src = src;
	}
}

function preloadImgs(srcs){
	if(!document.images) return;
	for (i=0;i<srcs.length;i++){
		preloadImg(srcs[i]);
	}
}

function swapImg(target,src){
	if(!document.images) return;
	document.images[target].src = src;
}

function kmout(name){};
function kmover(name){};

// end Smooth Scroll//


