// JavaScript Document
$(document).ready(function(){
	$('#news-wall').jScrollPane({showArrows:true,scrollbarWidth:13});
	$('#maxHeightArea').jScrollPane({showArrows:true });
	$('#web_chatSupport').click(chat);
	$('#web_skype').click(showSkypeDialog);
	
	//ESTIMATOR:
	enableEstimatorTabJavascript(false);
    
	addValidatorsEstimatorTab("estimatorSmallForm",true);
	
	$("#goButton").bind("mousedown", function(e){
		 if($('#txtUnderAge').val() == ''){
			$('#txtUnderAge').val(0);
		 }
	});
	$("#goButton").bind("click", function(e){
		$("#estimatorSmallForm").attr('action', $("#systemUrl").val() + 'estimator/processEstimatorSmall');
		$("#estimatorSmallForm").submit();
	});
	//END ESTIMATOR
	$('#web_sugestions').click(sugestions);
	$('#conctact_us').click(contactForm);
	
	$('.slideshow').cycle({
		fx:      'fade', 
    	speed:    100, 
    	timeout:  4000 
	});
	$('.slideshow2').cycle({
		fx:      'fade', 
    	speed:    100, 
    	timeout:  4000 
	});
	
	$("#dialog").dialog({
		bgiframe: true,
		autoOpen: false,
		width: 560,
		height: 510,
		modal: true,
		buttons: {
			'Cancelar': function() {
				$('#alerts_dialog').css('display','none');
				$(this).dialog('close');
			}
		  }
	});
	
	$('#skype_call_1').bind('click',function(){skype_call(1);});
	$('#skype_call_2').bind('click',function(){skype_call(2);});
	$('#skype_call_3').bind('click',function(){skype_call(3);});
	$('#skype_call_4').bind('click',function(){skype_call(4);});
	
});

function chat(){
	window.open('http://messenger.providesupport.com/messenger/bluecard.html?ps_s=sbG9eSUUg3S4&ps_mht=true','miniwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=700,height=550');
}

function sugestions(){
    location.href=document_root+"comments";
}

function contactForm(){
	window.location = document_root+"contactUs";
}

function showSkypeDialog(){
	$("#dialog").dialog('open');
}

function skype_call(line){
	if(skypeCheck()){
		$.ajax({
			url: document_root+ 'pGetSkypeLineAjax.php',
			type: "POST",
			data: { 'line': line},
			success: function(skype_line){
				window.location="skype:"+skype_line+"?call";
			}
		});
	}
}
