
	ajax_updater = function(id,url) {
		new Ajax.Updater(id, url, { 
				onComplete:function(){ 
						$('content-loader').style.display = 'none';
				}, 
				onLoading:function(){ 
						$('content-loader').style.display = 'block';
				}, 
		asynchronous:true, evalScripts:true});
	}
		
		 
	 ajaxForm = function (update, url, frm) {
			new Ajax.Updater(update, url, { method:'post', onComplete:function(){ $('loader').style.display = 'none';}, onLoading:function(){ $('loader').style.display = '';}, asynchronous:true, parameters:Form.serialize(frm), evalScripts:true});
			return false;	
	}
	
	ajax_request = function(url) {
		  new Ajax.Request(url, {
			  method: 'post',
			  onSuccess: ajax_updater('domains','domain-list.php'),
			  onFailure: function() { 
			  	alert("There was an error with the connection"); 
			}
		  });
	}


    openform = function(div) {
		Effect.BlindDown(div);
		$(div).style.display='';	
	}
	
	closeform = function(div) {
		Effect.BlindUp(div);
		$(div).style.display='';	
	}
	
	ajaxlink = function(id,url,src_id,code){
				new Ajax.Updater(id,url,
						{
							method: 'get',
							parameters: {id:src_id,ctype:code}
						});	
				$(id).remove(this); 
				
				} 
				
	ajaxget = function(id,url,params){
				new Ajax.Updater(id,url,
						{
							method: 'get',
							parameters: {id:params}
						});					
				}
	
	show_form = function() {
		var frm = $('frmview').value;			
		if(frm != 0 ) {
			ajaxget('google_form_view','render-form.php',frm);
			$('google_form_view').style.display = 'block';
		} else {
			$('google_form_view').style.display = 'none';
		}
	}


	popup = function(url) {
			
			newwindow=window.open(url,'name','height=450,width=650');
			if (window.focus) {
					newwindow.focus()
			}
			
			return false;	
				
		
	}
	
	
	closex = function(id) {
			
			$(id).style.display = 'none';
				
		
	}


	createCookie = function(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}

	readCookie = function(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}

	eraseCookie = function(name) {
		createCookie(name,"",-1);
	}

	setTheDivStyle = function() {
		if(!readCookie('MsG')) {
			// if cookie not found display the div and create the cookie
			createCookie('MsG', 'MsG'); // 1 day = 24 hours persistence
			document.getElementById("welcome-msg").style.display="block";
		}
		else {
			// if cookie found hide the div
			document.getElementById("welcome-msg").style.display="none";
		}
	}

	