	function curr(num) {
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
			num = "0";
			
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		
		if(cents<10)
			cents = "0" + cents;
			
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			num = num.substring(0,num.length-(4*i+3))+' '+
			
		num.substring(num.length-(4*i+3));
		
		return (((sign)?'':'-') +  num + '.' + cents);
	}	
	
	function window_ext(mypage,settings){    
   		var win;
        
    	if (!settings)
        	settings=new Array();
            
      /*  if (window.win)
            win.close();*/
            
        if (!settings.width)
        	settings.width=640;
        
        if (!settings.height)
        	settings.height=480;
                       
        if (!settings.title)
        	settings.title=':: eXpress project ::';
                                  
        win = new Ext.Window({
            layout      : 'fit',
            title:	settings.title,
    
            shadow:false,
            resizable: true,
            collapsible:true,
            maximizable:true,
            width       : settings.width,
            height		: settings.height,
            plain       : true,
            html:'<iframe src="'+mypage+'" width="100%" height="100%" scrolling="auto" frameborder="0"></iframe>'
        });	
                   
        win.show();
	}
	
	function copy(form,from,to){
		if (!from)
			from=Array();
			
		if (!to)
			to=Array();			
			
		if (from.length==to.length){
			for(i=0;i<=from.length-1;i++){
				form[to[i]].value=form[from[i]].value;
			}
		}
	}	
	
	//fckeditor // update editors content
	function getEditorContent(instanceName) {             
		var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
   	    return oEditor.GetXHTML( true ); 		      
	} 

	//to clear default field value
	function clearText(thefield){
		if (thefield.defaultValue==thefield.value)
			thefield.value = ""
	} 
	
	function setBackText(thefield){
		if (thefield.value=="")
			thefield.value = thefield.defaultValue;
	} 	
	
	
	session_interval=setInterval(function(){		
		myajax_Request({url:'forum/'});
	},300000);
			
	$(document).livequery(function () {	
		//login
		//login module
	/*	$(".login input").livequery("focus",function(){
			clearText(this);							   
		});
		$(".login input").livequery("blur",function(){
			setBackText(this);							   
		});		
	
		$(".login input").livequery("keydown",function(e){
			if (e.keyCode==13)													 
				this.parentNode.submit();						   
		});*/
		
		
		$("a").livequery(function(){
			var href=$(this).attr("href");
			
			if (href){
				ext=href.split(".");
				
				if (ext[ext.length-1].toLowerCase()=="mp3"){
					
					random_id='inline_mp3'+Math.random()+''+Math.random();
										
					$(this).html('<div id="'+random_id+'"></div><script>var so = new SWFObject("inline_mp3.swf", "", "100%", "24", "8", ""); so.addParam("menu", "false"); so.addParam("wmode", "transparent"); so.addVariable("song","'+$(this).html()+'"); so.addVariable("file","'+href+'"); so.write("'+random_id+'");</script>');
					
					$(this).bind("click",function(){					
						return false;							   
					});
					
				}
			}
		});						
		
		$("table.table_skinned tr:odd").addClass("rw"); 
		
		//$("table.table_skinned.vertical tr td:first-child").css({backgroundColor:'#ff0000'});
		$("table.table_skinned.vertical tr td:first-child").addClass("first"); 
		$("table.table_skinned.vertical tr th:first-child").addClass("first"); 		

		//blog archive
		$(".blog-archive a[href=#]").livequery("click",function(){
			if ($("ul:first",this.parentNode).css('display')=='none')											   
				$("ul:first",this.parentNode).slideDown("fast");		
			else
				$("ul:first",this.parentNode).slideUp("fast");
		
			return false;
		});
		
				
		$("#newsletter_button").livequery("click",function(){
			$(this).css({display:"none"});
			$("#newsletter_cont").slideDown("fast");	
			
			return false;
		});
		
		$("#attachfile").livequery("click",function(){	   
		   
			var newElement = document.createElement('input');
			newElement.type='file';
			newElement.name='filef[]';
		
	    	document.getElementById('filef_cont').appendChild(newElement); 
		
			return false;								  
		});		
						
				
	});

