
	function show_user(userID){
		if(userID==0){
			return("none");
		}
		else{
			return(userID);
		}
	}
	
	function bool_value(val){
		if(val==""||val==null){
			return(0);
		}
		else{
			return(1);
		}
	}
	
	function checked_value(val){
		if(val==""||val==null){
			return("");
		}
		else{
			return("checked");
		}
	}
	
	function rev_checked_value(val){
		if(val==""||val==null){
			return("checked");
		}
		else{
			return("");
		}
	}
	
	function bool_empty(val){
		if(val==""||val==null){
			return(1);
		}
		else{
			return(0);
		}		
	}
	function rev_bool_value(val){
		if(val==""||val==null){
			return(1);
		}
		else{
			return(0);
		}		
	}
	
	function nowDate(){
		var date = new Date();
		var d  = date.getDate();
		var day = (d < 10) ? '0' + d : d;
		var m = date.getMonth() + 1;
		var month = (m < 10) ? '0' + m : m;
		var yy = date.getYear();
	
		return(month + "/" + day + "/" + yy);
	}
		
	function showAsCurrency(str){
		var ret_str = "";
		str = "" + str;
	
		if(str!=""&&str!="null"){
			if(str.split(".").length>1){
				var currency_split = str.split(".");
				var left_currency = currency_split[0];
				var right_currency = currency_split[1];
				if(right_currency.length==1){
					ret_str = "$" + left_currency + "." + right_currency + "0";
				}else{
					ret_str = "$" + left_currency + "." + right_currency.substring(0,2);
				}
			}else{
				ret_str = "$" + str + ".00";
			
			}

		}
		return(ret_str);
	}
	
	function showAsTwoDecimalNumber(str){
		var ret_str = "";
		
		if(str!=null){
			str = "" + str;
			if(str.split(".").length>1){
				var string_split = str.split(".");
				var left_split = string_split[0];
				var right_split = string_split[1];
				if(right_split.length==1){
					ret_str = left_split + "." + right_split + "0";
				}else{
					ret_str = left_split + "." + right_split.substring(0,2);
				}
			}else{
				ret_str = str + ".00";
			
			}
		}
		return(ret_str);
	}
	
	function showAsOneDecimalNumber(str){
		var ret_str = "";
		str = "" + str;
	
		if(str.split(".").length>1){
			var string_split = str.split(".");
			var left_split = string_split[0];
			var right_split = string_split[1];
			if(right_split.length==1){
				ret_str = left_split + "." + right_split;
			}else{
				ret_str = left_split + "." + right_split.substring(0,1);
			}
		}else{
			ret_str = str + ".0";
		
		}
		return(ret_str);
	}

	function change_image(option){
		//alert("banner");
		// for adding product images to products
		if(option.selectedIndex>0){
			document.banner_image.src =  option.options[option.selectedIndex].value;
		}else{
			document.banner_image.src = "images/choose_image.jpg";	
		}
	}
	
	function edit_image(option,form){
		// for adding product images to products
		if(option.selectedIndex>0){
			document.banner_image.src =  option.options[option.selectedIndex].value;
			if(option.selectedIndex==1){
				form.selectedIndex = 0;
			}else{
				form.selectedIndex = 1;
			}
			
		}else{
			document.banner_image.src = "images/choose_image.jpg";	
			//form.new_image.value = 1;
		}
	}
	
	function showBody(){
		//document.body.style.backgroundColor = "#333366";
		document.body.style.visibility = "visible"; 
	}
	
	function code_window_open(page){
		window.open(page,"popup","menubar=no,toolbar=no,width=570,height=870,scrollbars=no")
		return(false);
	}
	
	function mobile_window_open(page){
		window.open(page,"popup","menubar=no,toolbar=no,width=550,height=800,scrollbars=yes")
		return(false);
	}	
	
	
	
	function magnified_code_window_open(page){
		window.open(page,"popup","menubar=no,toolbar=no,width=700,height=720,scrollbars=no")
		return(false);
	}	
	
	
	
	function picture_window_open(page){
		//alert("test");
		window.open(page,"popup","menubar=no,toolbar=no,width=600,height=600,scrollbars=no")
		//alert("test2");
		
		//return(false);
	}

	function showBody() { }


	function facebookShare(title, url) {
	    //alert('http://www.facebook.com/sharer.php?u=' + url + '&t=' + encodeURIComponent(title));
	    window.open('http://www.facebook.com/sharer.php?u=' + url + '&t=' + encodeURIComponent(title), 'sharer', 'toolbar=0,status=0,width=626,height=436');
	    return false;
	}
	
	
	function twitterShare(title, url) {
	    window.open('http://twitter.com/share?url=' + url + '&text=' + encodeURIComponent(title), 'sharer', 'toolbar=0,status=0,width=800,height=600');
	    return false;
	}	
	
	
	
	
