var vsf = {
	get:function(act, id) {
		
	$.get(ajaxurl+act,function(data){
		if(id!='') {
			$("#"+id).html(data).css('display','none').fadeIn('slow');
		}
	});
	},

	submitForm:function(obj,act,id) {
		if(typeof(tinyMCE) != "undefined") tinyMCE.triggerSave();

		$("#"+id).html('<img src="'+imgurl+'loader.gif"/>');
		var params = {
			vs:act,
			ajax: 1
		};
		
		var count = 0;
		obj
		.find("input[type='radio']:checked, input[checked], input[type='text'], input[type='hidden'], input[type='password'], input[type='submit'], option[selected], textarea")
		.each(function() {
			params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = this.value;
		});
		$.post(ajaxfile,params,function(data) {
			$("#"+id).html(data).css('display','none').fadeIn('slow');
			$('#page_tabs').tabs();
		});
	},
	upload:function(act_add_image, name_filed_image){
		var data, errorMessage="";
		$.ajaxFileUpload
		(
			{
				url: "admin.php?vs=products/addimage/&ajax=1",
				secureuri: false,
				fileElementId : 'file_0',
				dataType: 'json',
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							errorMessage = errorMessage + data.error;
							alert(errorMessage);
						}
						else	alert("s");
					}
				},
				error: function (data, status, e)
				{
					alert(errorMessage);
					errorMessage = errorMessage + e;
				}
			}
	);	
		
		return errorMessage;
	},
	
	isDefined:function(obj) {
    	return (typeof(obj) == "undefined")?  false: true;
	},
	
	removeForm:function(id){
		$("#"+id).html('');
	},
	
	select_switch:function(status ,object){
		for (i = 0; i < object.length; i++)
			object.elements[i].checked = status;
	},
		 
	checkbox:function(the_value,the_list){
		if(the_value==the_list.value){
			the_list.checked=true;
			return true;
		}
	},
	 
	radio:function(the_value,the_list){
		var name_count = the_list.length; 
		for(i=0;i<name_count;i++)
			if (the_value==the_list[i].value){
				the_list[i].checked=true;
				return true;
			}
	 },
	 
	select:function (the_value,the_list){
		var option_count = the_list.options.length; 
		for(i=0;i<option_count;i++)
			if(the_value==the_list.options[i].value){
				the_list.options[i].selected=true;
				return true;
			}
	},
	
	 alert:function (message){
		jAlert(
			message,
			global_website_title +" Dialog"
		);
	}
}
