jQuery(document).ready(function(){
	jQuery(".settings").each(function (i) {
		var $this = jQuery(this);							 
		var clip = new ZeroClipboard.Client();
		clip.setText( $this.find('span').text() );
		clip.setHandCursor( true );
		clip.setCSSEffects( true );
		
		var href = $this.attr('href');
		
		clip.addEventListener('complete', function (client, text) {
			window.open(href);
			$this.removeClass('hover');
		});
		
		clip.glue( $this.attr("id") , $this.parent().attr("id"));
		
	});
	
	var submit_action=0;
	jQuery(".settings_save").click(function(){
		chkobjs=new Array("location","mainphone","creditcards","facebookurl","twitterurl","youtubeurl");
		for(i=0;i<chkobjs.length;i++)
		{
			if(!jQuery("#"+chkobjs[i]).val())
			{
				jQuery("#"+chkobjs[i]).focus();
				return;
			}
		}
		submit_action=1;
		jQuery("#dealer_settings_edit_form").submit();
	});
	jQuery("#dealer_settings_edit_form").submit(function(){
		if(!submit_action)
			return false;
	});
				
	});
	
});

