var redirURL = '';
var URL = 'http://www.1stclassbreeders.com/';
$(document).ready(function(){
	$.getScript('http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js',
		function(){
			var flashvars = false;
			var params = {
				menu:"false",
				flashvars:"site="+URL+"&bordercolor=b19918&txtcolor=18618b"
			};
				
			var attributes = {
				id:"web_gallery",
				name:"web_gallery"
			};
			swfobject.embedSWF(URL+"web_slideshow.swf","webgallery","150","115","9.0.0","expressInstall.swf",flashvars,params,attributes);
		});
});
var Functions = {
	error: function (msg) {
        $.prompt('<div class="error">ERROR:</div>' + msg);
    },
    success: function (msg) {
        $.prompt('<div class="success">SUCCESS:</div>' + msg);
    },
	load: function(d){
		$('#'+response_div).hide().html('');
		$('#'+content_div).hide().html('');
		$('#'+loader_div).fadeIn(
			function(){
				$.get(cf+'.php?action='+d,
					function(p){
						$('#'+loader_div).fadeOut(
							function(){
								$('#'+content_div).html(p).show();
								$('#'+loader_div).hide();
							});
					},'script');
				});
	},
	form_send:function(){
		var values = $("#fcbform").serialize();
		$('#'+response_div).hide().html('');
		$('#'+content_div).hide().html('');
		$('#'+loader_div).fadeIn(
			function(){
				$.getJSON(cf+'.php?'+values,
					function(d){
						$('#'+loader_div).fadeOut(
							function(){
								$('#'+response_div).html(d.msg);
								$('#'+response_div).show();
								$('#'+loader_div).hide();
								setTimeout("Functions.load('"+d.call+"');",1000);
							});
					});
			});

	},
	frame_send : function(){
		var values = $("#fcbform").serialize();
		$('#'+response_div).hide();
		$('#'+loader_div).show();
		$('#'+content_div).hide();
		Functions.goto(cf+'.php?'+values,'iframe');
	},
	framed_response : function(d){
		$('#'+loader_div).fadeOut(
			function(){
				$('#'+response_div).html(d.msg).show();
				if(d.call){
					setTimeout("Functions.load('"+d.call+"');",1000);	
				}
		});
	},
	goto:function(_url, _target) {
		window.open(_url, _target);
	},
	redirect:function() {
		this.goto(redirURL, '_self');
	},
	reload_it:function() {
		document.location.reload();
	},
	rateit:function(p){
		$('#vote').html('Sending...');
		$.getJSON('ajax.php?action='+p.action+'&id='+p.id+'&vote='+p.vote,
			function(d){
				$('#msg_'+p.id).html(d.msg);
				if(d.status == 0){
					$('#rate_'+p.id).html(d.rating);
					$('#vote_'+p.id).html(d.votes);
				}
			},'script');
	},
	scrollTo:function(selector) {
        var targetOffset = $(selector).offset().top;
        $('html,body').animate({scrollTop: targetOffset}, 500);
    }
};
function silentErrorHandler() {return true;}
window.onerror=silentErrorHandler;
