Learn how to use jQuery at the Blog

Hierzo « visit

  • Added 6 months ago
  • 115 Lines of Code shown
  • 3 Links of Interest
http://hierzo.net
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to Hierzo - http://hierzo.net

	function panoswf(select) {
		var params = {
			quality: "best",
			bgcolor: "#FFFFFF",
			allowfullscreen: "true"
		} 		
		
		var flashvars = {}
		
		var attributes = {}
		attributes.align = "left";
		swfobject.embedSWF("/pano/"+select+".swf", "flashcontent", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
	}
	
	function doswf(select) {
		var eB = false;
		if (eB) {
			window.moveTo(0,0);
			window.resizeTo (screen.availWidth, screen.availHeight);
		}	

	
		// SWFObject embed
		var flashvars = {
			paramXMLPath: select+".xml",
			initialURL: escape(document.location)
		}
		
		var params = {
			quality: "best",
			bgcolor: "#FFFFFF",
			allowfullscreen: "true"
		} 
               

		var attributes = {}
		attributes.align = "left";
		swfobject.embedSWF("loader.swf", "flashcontent", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
	}
	
	function panel(name,cl) {
		$('.'+cl).hide();
		$('#'+name).show();
	}

	function load(module,cmd,id) {
		$.ajax({
			url: 'index.php?cmsAjax=1&cmsModule='+module+'&cmsCmd='+cmd+'&cmsId='+id,
			type: 'GET',
			dataType: 'xml',
			timeout: 5000,
			success: processXml
		});				
	}
	
	function validate(formData, jqForm, options) { 
	    for (var i=0; i < formData.length; i++) { 
	        if (!formData[i].value) { 
	            alert('Please fill in your name, email and a comment.'); 
	            return false; 
	        } 
	    } 
	}
	
	
	function putString(text,name) {		
		$('#'+name).val($('#'+name).val() + text);		
	}


	function processXml(responseXML) {	
		$.history( responseXML );
		sortXML( responseXML );
	}
	
	function sortXML(responseXML) {
		var message = $('html', responseXML).text();
		var div = $('div',responseXML).text();
		var id = $('id',responseXML).text();
		var cmd = $('cmd',responseXML).text();
		var swf = $('swf',responseXML).text();	
		
		$('#main').hide();		
   		$('#'+div).html(message);	

		$('#main').fadeIn("slow");
		
		if (swf == "photo") { 
			doswf(id); 
		} else if (swf == "pano") {
			panoswf(id); 
		}
		$("form").ajaxForm({ beforeSubmit: validate, dataType:  'xml',success:   processXml  });
	}
	
	$.history.callback = function ( reinstate, cursor ) {
		if (reinstate) sortXML(reinstate);
		else load("home","view","frontpage");
	};

	$(document).ready(function(){	
		$("#loading").ajaxStart(function(){
			$(this).fadeIn("fast");
		});

		$("#loading").ajaxStop(function(){
			$(this).fadeOut("slow");
		});
		
		$("#loading").fadeOut("slow");
		$("form").ajaxForm(function() {
		     alert("Thank you for your comment!"); 
		});
		$("form").ajaxForm({ beforeSubmit: validate, dataType:  'xml',success:   processXml  });
	});