// JavaScript Document

	$(document).ready(function(){	
		$("textarea#quirk").val('');		
	});
					
	function doSomethingWithData(data) {
		$("textarea#quirk").val('');									   
		$("textarea#quirk").focus();
		$("textarea#quirk").val(data);
	}
		
	function generate_quirk(){	
		$.get('generate.php', doSomethingWithData);								
	}
	
	function submit_quirk_alert(){
		alert('Please Register/Log-in to Post Quirk!');					
	}
	
	function vote_alert(){
		alert('Please Register/Log-in to Vote Quirk!');			
		window.location = "index.php#content";
	}
	
	function vote_alert_browse_top(){
		alert('Please Register/Log-in to Vote Quirk!');			
		window.location = "index.php?tab=browse_top_quirks#content";
	}	
	
	function vote_alert_browse_recent(){
		alert('Please Register/Log-in to Vote Quirk!');			
		window.location = "index.php?tab=browse_recent_quirks#content";
	}			
	
	function click_readymadeimage(){
		$('#p_image').css('{"padding":"3px", "border":"thin", "border-color":"#666666", "border-style":"solid", "border-width":"1px"}');
	}	
	
	function checkLength(obj) {
		objlength = obj.value.length;
		if(objlength > 120)
			obj.value = obj.value.substring(0,120);
		$("#charactercount").text(120-obj.value.length);
		return true;
	}
	
	function isOnLimit(obj) {
		objlength = obj.value.length;
		if(objlength > 120)
			obj.value = obj.value.substring(0,120);
		$("#charactercount").text(120-obj.value.length);
		return true;
	}
	
	function close_tooltip(){
		$('.tooltip').css("display", "none");
	}

/*	win an ipod

	function simple_tooltip(target_items, name, close_link){
	 $(target_items).each(function(i){
			$("body").append("<div class='"+name+"' id='"+name+i+"'>"+$(this).attr('title')+"<div style='"+"width:320px; height:18px; vertical-align:middle; background-color:#9F9F9F; text-align:right;"+"'><a href='"+"javascript:void(0);"+"' class='"+close_link+"' onclick='"+"close_tooltip();"+"'>close</a>&nbsp;</div><div style='"+"width:320px; height:5px; background-color:#FFFFFF;"+"'></div><div style='"+"width:320px; background-color:#FFFFFF; font-family:Arial, Helvetica, sans-serif; font-weight:bold;"+"'>&nbsp;&nbsp;Two Ways To Win<div><div style='"+"width:320px; height:5px; background-color:#FFFFFF;"+"'></div><div style='"+"width:320px; background-color:#FFFFFF; font-family:Arial, Helvetica, sans-serif; font-weight:normal; font-size:12px; color:#033333;"+"'>&nbsp;&nbsp;1. Be chosen as a Top Quirk (votes + judging)<br />&nbsp;&nbsp;2 .Gain raffle points by voting on quirks<br /><br />&nbsp;&nbsp;So start posting and voting!"+"</div><div style='"+"width:320px; height:5px; background-color:#FFFFFF;"+"'></div></div>");
			var my_tooltip = $("#"+name+i);
	
			$(this).removeAttr("title").mouseover(function(){
					my_tooltip.css({opacity:0.9, display:"none"}).fadeIn(400);
			}).mousemove(function(kmouse){
					my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
			});
		});
	}*/
	
	function simple_tooltip(target_items, name, close_link){
	 $(target_items).each(function(i){
			$("body").append("<div class='"+name+"' id='"+name+i+"'>"+$(this).attr('title')+"<div style='"+"width:320px; height:18px; vertical-align:middle; background-color:#9F9F9F; text-align:right;"+"'><a href='"+"javascript:void(0);"+"' class='"+close_link+"' onclick='"+"close_tooltip();"+"'>close</a>&nbsp;</div><div style='"+"width:320px; height:5px; background-color:#FFFFFF;"+"'></div><div style='"+"width:320px; height:5px; background-color:#FFFFFF;"+"'></div><div style='"+"width:320px; background-color:#FFFFFF; font-family:Arial, Helvetica, sans-serif; font-weight:normal; font-size:12px; color:#033333;"+"'>&nbsp;&nbsp;Lewis and Pearl The real you rocks promo have already<br />&nbsp;&nbsp;ended. Winners will be announced on the site by 20<br />&nbsp;&nbsp;September 2010 and will also be notified via registered mail."+"<br /><br /></div><div style='"+"width:320px; height:5px; background-color:#FFFFFF;"+"'></div></div>");
			var my_tooltip = $("#"+name+i);
	
			$(this).removeAttr("title").mouseover(function(){
					my_tooltip.css({opacity:0.9, display:"none"}).fadeIn(400);
			}).mousemove(function(kmouse){
					my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
			});
		});
	}
	

/*	function simple_tooltip(target_items, name){
	 $(target_items).each(function(i){
			$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"<br />Two Ways To Win<br /><br />1. Be chosen as a Top Quirk (votes + judging)<br />2 .Gain raffle points by voting on quirks<br /><br />So start posting and voting!"+"</p></div>");
			var my_tooltip = $("#"+name+i);
	
			$(this).removeAttr("title").mouseover(function(){
					my_tooltip.css({opacity:0.9, display:"none"}).fadeIn(400);
			}).mousemove(function(kmouse){
					my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
			}).mouseout(function(){
					my_tooltip.fadeOut(400);2. 
			});
		});
	}*/
	
	//$(document).ready(function(){				   
		//simple_tooltip("#ipad","tooltip","close_link");
	//});	
