function Inputt(){}
Inputt.prototype = {
	init:function() {

		$('input').focus(function() {
			if (this.value == this.defaultValue) {
				$(this).val('');
			}
		}).blur(function() {
			if (this.value == '') {
				$(this).val(this.defaultValue)
			}
		});	
	}
	}
	$(function(){
	var forminput = new Inputt();
	forminput.init();
});

/*--------------------------------------------------------------------------*/ 

window.onload = function () {
	/* height match */
	var content = $('#contents');
	if (content.length) {
		var divHeight = content.height() - 30;
		$('#news_sidebar_newsroll').height(divHeight);
	}

}

$(document).ready(function () {
	Cufon('h2')('h3')('h4')('h5')('.read_more')('.pagination')('p.privacy')('span.subhead')('span.descript')('span.sizes')('ul.tabs li')('div.size li')('p.rapro')('p.foot')('p.posted')('#search_box p');



	/* tabs */	
	var tab_content = $(".tab_content"), prevTab = "tab1";
	$('#'+ prevTab).show();
	if (tab_content.length) {
		/*
		var tabs1 = $(".tabs")		
		.tabs({				
			jqAddress: {
				title: {
					split: ' ~ '		
				}
			}
		});*/
		
	
		 // Event handlers
		$.address.init(function(event) {
			
			tab_content.hide(); //Hide all content
			
			$("ul.tabs li a").click(function() {
				return $(this).attr('href').replace(/^#/, '');
			});
		}).change(function(event) {
			if(event.value != "") {
				
				$('#'+ prevTab).hide(); //Hide all tab content
				prevTab = event.value;
				
				$('#'+ event.value).show();
			} else {
				//if(event.value == "") {
					$('#'+ prevTab).hide(); //Hide all tab content
					$(".tab_content:first").show(); //Show first tab content
					prevTab = "tab1";
				//}
			}
			
		});	
	}
	
	/* contact form */
	var contactForm = $('#contactform');
	if (contactForm.length) {
		contactForm.submit(function(){
		
			var action = $(this).attr('action'), message = $('#message');
			
			message.slideUp(750,function() {
			message.hide();
			
			$('#submit')
				.after('<img src="http://www.rawmethod.com/images/raw/ajax-loader.gif" class="loader" />')
				.attr('disabled','disabled');
			
			$.post(action, { 
				name: $('#name').val(),
				email: $('#email').val(),
				phone: $('#phone').val(),
				comments: $('#comments').val(),
			},
				function(data){
					document.getElementById('message').innerHTML = data;
					message.slideDown('slow');
					contactForm.find('img.loader').fadeOut('slow',function(){$(this).remove()});
					contactForm.find('#submit').attr('disabled',''); 
					if(data.match('success') != null) contactForm.slideUp('slow');
					
				}
			);
			
			});
			
			return false; 
		
		});	
	}
	
});
