function changeContent(id)
{
	switch(id)
	{
		case 1:
			data="home.html";
			break;
		case 2:
			data="features.html";
			break;
		case 3:
			data="";
			break;
		case 4:
			data="";
			break;
		case 5:
			data="/cu3er/";
			break;
		case 6:
			data="signup.html";
			break;
		default:
			data="";
	}
	if(data!="")
	{
	$j(".notApp").animate({opacity:0}).load(data).animate({opacity:1},"500");
	}

}
function getWinWidth()
{
	if (parseInt(navigator.appVersion)>3) 
	{
		if (navigator.appName=="Netscape") 
	    {
			return(window.innerWidth);
	    }
		if (navigator.appName.indexOf("Microsoft")!=-1) 
	    {
			return(document.body.offsetWidth);
	    }
	}
} 
	  
function getWinHeight()
{
	if (parseInt(navigator.appVersion)>3) 
	{
		if (navigator.appName=="Netscape") 
	    {
			return(window.innerHeight);
	    }
		if (navigator.appName.indexOf("Microsoft")!=-1) 
	    {
			return(document.body.offsetHeight);
	    }
	}
}

jQuery(document).ready(function(){
	jQuery('.lavaLampWithImage li')
	.css( {backgroundPosition: "0 -250Px"} )
.mouseover(function(){
	jQuery(this).stop().animate(
		{backgroundPosition:"(0 0px)"}, 
		{duration:500})
	})
.mouseout(function(){
	jQuery(this).stop().animate(
		{backgroundPosition:"(0 -250)"}, 
		{duration:500})
	})
});
/* powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$j("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$j("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		$j("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$j("#preview").remove();
    });	
	$j("a.preview").mousemove(function(e){
		$j("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
jQuery(document).ready(function(){
	imagePreview();
	$j("#closeBtn").click(function(){
		$j("#BackgroundPopup").fadeOut(700);
		$j('#popupcontent').fadeOut('slow');
	})
	$j("input").focus(function(){
		$j(this).next("div.ermsg").hide();
//		$j(this).css({border: "1px solid #262626"});
	});
});

function showSignup()
{
	w = getDimensions();
	if(document.getElementById('errorMsgDiv'))
		document.getElementById('errorMsgDiv').innerHTML="";
	$j('#signupbg').css({left: (w[1]-850)/2,
		top: window.pageYOffset + ((w[0]-150)/2)});
	$j("#BackgroundPopup").fadeIn(700);
	
	
	document.getElementById('signupformdiv').innerHTML = '<div id="errorMsgDiv" style="visibility:hidden;"></div><table width="100%" style="border: 1Px solid #000;-moz-border-radius-topleft: 5Px;-moz-border-radius-topright: 5Px;"><tr><td style="vertical-align: middle;height: 70Px;font-size: 15Pt;padding: 3Px;background: #4ca2fb; color: #000;text-align:center;background: url(\'/images/assetmapperlogoforbg.png\') #6495ed no-repeat left;">Account Sign up</td></tr><tr><td style="padding: 3Px;text-align: center;padding-top:20Px;"><b>Ready to sign up?</b> Please enter your email address and we\'ll send you a message to your email. You will have to click the link in the email to verify your email id and create the account.<br><br><input type="text" id="user_email" name="user[email]" value=""><br><label class="sbtn" onclick="loginsign(\'signup\')"><img src="/images/signupbtn.png"></label><br></td></tr></table><div id="loadingDivSignup" style="color: #000;display:none;">Sending mail...</div>';
	
//	document.getElementById('signupbg').innerHTML = 'Enter your E-Mail id here:<br><input type="text" id="user_email" name="user[email]" value=""><label class="buton" onclick="loginsign(\'signup\')">Sign Up</label>';
	$j('#signupbg').fadeIn('slow');
}

function getContent(type)
{
	w = getDimensions();
//	window.scrollTo(0, 0);
//	alert(window.pageYOffset);
	$j('#popupbg').css({left: (w[1]-700)/2,
		top: window.pageYOffset + 25});
	AjaxUpdater('popupcontent','/events/getContent/1?type='+type,{asynchronous:true, evalScripts:true});
	$j("#BackgroundPopup").fadeIn(700);
	$j('#popupbg, #popupcontent').fadeIn('slow');
}

function showLogin()
{
	w = getDimensions();
	$j('#tourbg').css({left: (w[1]-600)/2,
		top: window.pageYOffset + 200});
	$j("#BackgroundPopup").fadeIn(700);
	$j('#tourbg').fadeIn('slow');	
}
function closeLogin()
{
	try{
	$j('#tourbg').fadeOut('slow');
	$j("#BackgroundPopup").fadeOut(700);
	}catch(e){alert(e);}
}
function d(opt)
{
	try{
	if(opt == 1)
		document.adminForm.submit();
	else
		document.techForm.submit();
	}catch(e){//alert(e);
		
	}
}

var filter = /^.+@.+\..{2,3}$/
function sendContactMsg()
{
	try{
	email = document.getElementById('user_email').value;
	msg = document.getElementById('email_message').value;
	captcha = (document.getElementById('captcha').value).toLowerCase();
	captchaid = document.getElementById('captchaid').value;
	if (filter.test(email))
	{		
		response = AjaxResponse('/news/sendmail/1?user_email='+email+'&email_message='+msg+'&c='+captcha+'&cid='+captchaid);
		if(response == "success"){
			document.getElementById('QfeedBack').innerHTML = "Thank you for your message. We will get back to you.";
			document.getElementById('QfeedBack').style.color = "#00CC00";
			document.getElementById('QfeedBack').style.fontSize = "15Px";
		}
		else if(response == "fail"){
		AjaxUpdater('captchaq','/news/captcha/1',{asynchronous:true, evalScripts:true});
		document.getElementById('captchaq').innerHTML = document.getElementById('captchaq').innerHTML + "<center><font color='#CC0000'>Incorrect answer</font></center>";}
	}
	else
	{document.getElementById('user_email').style.background = "#CC0000";}
	}catch(e){alert(e);}
}

