/**
 * This Source Is created By : Aimad Jait
 * Email : jait.aimad@gmail.com
 * CopyRights © 2011
 * This File Required Presented of : Jquery > 4
 */
//Global Vars
var x;

/*
 * ****
 * *************Uploader
 * ****
 */
function Delete_File(file_name, io)
{
	$.post(base_url+'home/delete_file', { file_name: file_name } );
	//Delete block
	$('.file_'+io).remove();
	$("[name=isupfile]").val('');
	$("#upload").show();
	return false;
}

/*
 * ****
 * *************Global Functions
 * ****
 */

//Console Log
function console(vars)
{
	console.log(vars);
}
//Explode string in array with Delimiter (== explode in PHP)
function explodeArray(item,delimiter) { 
	tempArray = new Array(1); 
	var Count = 0; 
	var tempString = new String(item);
	
	while (tempString.indexOf(delimiter)>0) { 
		tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter)); 
		tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1); 
		Count=Count+1 
	}
	
	tempArray[Count]=tempString; 
	return tempArray; 
}

/*
 * ****
 * *************FORM FUNCTIONS
 * ****
 */


//Function For validate input with JQuery
function ValidateInput(x)
{
	var return_valu = false;
	var inpu = $("[name="+x+"]").val();
	if(inpu)
	{
		return_valu = true;
	}
	return return_valu;
}

//Function For validate Email
function ValidateEmail(x)
{
	var atpos=x.indexOf("@");
	var dotpos=x.lastIndexOf(".");
	if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
	{
		return false;
	}
	else
	{
		return true;
	}
}



