if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) {
var viewportmeta = document.querySelectorAll('meta[name="viewport"]')[0];
if (viewportmeta) {
viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0';
document.body.addEventListener('gesturestart', function() {
viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6';
}, false);
}
}

function testimonials_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
	/*
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });
	*/
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(function(){
	$('#main_nav ul').superfish();
	$(':text').focus(function(){ if(this.value == this.title) this.value=''});
	$(':text').blur(function(){ if(this.value == '') this.value=this.title});
	$('#click-to-call').attr('target','Callback_RingMe');
	$('#click-to-call').click(function(){	 
		window.open("http://www.ringcentral.com/ringme/?uc=515F5B71C4C24A250D6A5D48849A6105491965318736,0,101&s=no&v=2", "Callback_RingMe", "resizable=no,width=380,height=360");
		return false;
	});
	$("#20111027-how_to_turn_clicks_into_cash").flash({ swf: "/asset/flvPlayer/flvPlayer.swf", wmode: "opaque", width: 640, height: 360, flashvars: { skinName: "/asset/flvPlayer/clearSkin_3", streamName: "http://www.imsmembers.com/videos/20111027-how_to_turn_clicks_into_cash", autoPlay: false, autoRewind: false }});
	$(".webinar").css({ width: '640px', margin: '0 auto'});
	$('.datepicker').datepicker({ beforeShowDay: $.datepicker.noWeekends, minDate: new Date(), dateFormat: "yy-mm-dd"});
	//$('#testimonials').jcarousel({ auto: 2, wrap: 'last', initCallback: testimonials_initCallback});
	$('a[rel~="external"]').click(function(){$(this).attr('target','_blank');});
});
