$(document).ready(function()
{
	//scroll the message box to the top offset of browser's scrool bar
	$(window).scroll(function()
	{
		$('#message_box').animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350});  
	});
	//when the close button at right corner of the message box is clicked 
	$('#close_message').click(function()
	{
		//the messagebox gets scrool down with top property and gets hidden with zero opacity 
		$('#message_box').animate({ top:"+=15px",opacity:0 }, "slow");
	});
});

function ajaxModalbox(url,parameters)
{
	Modalbox.show(url, {title: 'Preview', height: 480, width: 640, params: {} });
	return false;
}

// For ajax executing script in response
function parseScript(_source) 
{
	var source = _source;
	var scripts = new Array();
	
	// Strip out tags
	while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) {
		var s = source.indexOf("<script");
		var s_e = source.indexOf(">", s);
		var e = source.indexOf("</script", s);
		var e_e = source.indexOf(">", e);
		
		// Add to scripts array
		scripts.push(source.substring(s_e+1, e));
		// Strip from source
		source = source.substring(0, s) + source.substring(e_e+1);
	}
	
	// Loop through every script collected and eval it
	for(var i=0; i<scripts.length; i++) {
		try {
			eval(scripts[i]);
		}
		catch(ex) {
			// do what you want here when a script fails
		}
	}
	
	// Return the cleaned source
	return source;
}
