/*******
			PROMPT FOR INPUT TEXT FIELDS
******/

function input_click (id, my_prompt)
{
	//Show and Hide Input text fields depending on click.
	$('#' + id).data('my_prompt', my_prompt);
	$('#' + id).click(function() {
		if($(this).val() == $(this).data('my_prompt'))
    	{
      		// remove inline prompt text
			$(this).val('').removeClass('prompt');
			// add password field
		  	// $(this).parent.addChild(new Elem());
			// remove text field
			// $(this).remove();
			//HACK: Assume password fields have an ID ending in "_password"
			if ($(this).attr('id').indexOf('_password') > -1) {
				this.type='password'; 
				$(this).focus();
			}
			//alert(id);
		};
		if($(this).val() != $(this).data('my_prompt'))
    	{
      		// remove inline prompt CSS
			$(this).removeClass('prompt');
		};
	}).blur(function() {
		if($(this).val() == '' || $(this).val() == $(this).data('my_prompt'))
    	{
     		// re-apply inline prompt on blur
			$(this).val($(this).data('my_prompt')).addClass('prompt');
			// add text field
		 	// $(this).parent.addChild(new Elem());
			// remove password field
			// $(this).remove();
			//$(this).replace('<input type="text" />');
			//HACK: Assume password fields have an ID ending in "_password"
			if ($(this).attr('id').indexOf('_password') > -1)  this.type='text';
		};
	}).focus(function(){
		$(this).trigger('click');
	}).blur();	
	
};

function change_input_prompt (id, new_prompt)
{
	$('#' + id).click().data('my_prompt', new_prompt).blur();
}

function hover_change_input_prompt (selector, id, new_prompt)
{
	$(selector).hover(function() {
		change_input_prompt(id, new_prompt);
	}, function () {});
}


/*
HACK/TODO 
Note, MF would like to see these moved to views, essentially.
*/

$(document).ready(function() { 
	//these 3 are for beta invite-only page:
	input_click('account_seeker_email', 'enter email address');
	input_click('account_login', 'enter email address');
	
	//for the "top get started" widget
	// if($('.topNewUrl').length){
	// 	input_click('widget_store_provider_url', 'example http://cafepress.com/yourstore/123456') ;
	// }
		if($('.topNewUrl1').length){
		input_click('ctl00_widget_store_provider_url', 'example Seller ID: 123456') ;	
	}
});

  


