//function to show or hide fckeditor
function showHideDes(toggle_id){

if(document.getElementById(toggle_id).style.display=='none')
	toggle = 'inline';
else
	toggle = 'none';

document.getElementById(toggle_id).style.display=toggle;
}

function showNotes(id){
	$('#recordId').val(id);
	$.ajax({
		type: "POST",
		url: "order_ajax.php",
		data: "action=show"+"&id="+id,
		success: function(msg){
			$('#addnote').slideDown();
			$('#note').val(msg);
		},
		error:function(){
			alert('Internal server error!');
		}
	});
}

function saveNote(){
	var note = $('#note').val();
	var id 	 = $('#recordId').val(); 
	if(note.length<5){
		$('#msgBox').html("<span style='color:red; padding:2px;'>Please enter atleast 5 charactors in notes.").show();
	}
	else{
		$('#msgBox').html('');
		$.ajax({
			type: "POST",
			url: "order_ajax.php",
			data: "action=save&note="+note+"&id="+id,
			success: function(msg){
				if(msg==1){
					$('#msgBox').html("<span style='color:green; padding:2px;'>Note has been saved successfully.");
					$('#msgBox').show();
					setTimeout($('#addnote').slideUp(),5000);
					$('#msgBox').html('');
				}
				else{
					$('#msgBox').html("<span style='color:red; padding:2px;'>Sorry! Server error occured.");
					$('#msgBox').show();
				}
			},
			error:function(){
				alert('Internal server error!');
			}
		});
	}
}

function exportIMEI(){
	// get the all IMEI number which are under processing
	
		$.ajax({
			type: "POST",
			url: "export_import_imei.php",
			data: "action=export",
			success: function(msg){
				//alert(msg);
			},
			error:function(){
				alert('Internal server error!');
			}
		});
}
function showUploadFile(){
	
	$('#uploadfile').slideDown();
}

function showORhide_Filter_Form(){
	
	var hide_or_show = document.getElementById("hideORshow_table");
	if(hide_or_show.innerHTML=='Show Filter Form')
	{
		$('#showhide_filter_form').slideDown();
		document.getElementById("hideORshow_table").innerHTML = 'Hide Filter Form';
	}
	else
	{
		$('#showhide_filter_form').slideUp();
		document.getElementById("hideORshow_table").innerHTML = 'Show Filter Form';
	}
}


function show_login_form(){
	
	
	$('#login_form').slideDown();
	
}

function show_reply_form(id,uname){
	
	
	var id=id;
	var uname = uname;
	document.getElementById('reply_email_feedback').value=id;
	document.getElementById('sub').value=uname;
	
	$('#reply_form').slideDown();
}

function null_validation()
{
	var email = document.getElementById("email");
	var pass = document.getElementById("pwd");
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if(email.value=="")
	{
		alert ("Please Enter Email Id");
		email.focus();
		return false;
	}
	if(!(email.value).match(reg))
	{
		alert ("Invalid Email Id Format");
		email.focus();
		return false;
	}
	if(pass.value=="")
	{
		alert ("Please Enter Password");
		pass.focus();
		return false;
	}
	return true;
}



//function to show or hide fckeditor
function showHideDes(toggle_id){

if(document.getElementById(toggle_id).style.display=='none')
	toggle = 'inline';
else
	toggle = 'none';

document.getElementById(toggle_id).style.display=toggle;
}

//function to ask for confirmation before removing the prd forever
function delete_prd(prd_mep_id,url)
{
	var delete_prd=confirm("Do you really want to delte this PRD and all the information associated with this PRD?");
	if(delete_prd)
	{
		window.location.href="06indi02go89.php?show=view_prdno&action=Delete&id="+prd_mep_id+"&url="+url;
	}
}
//function to ask for confirmation before removing the mep forever
function delete_prd_mep(prd_mep_id,mep_no,url)
{
	var delete_prd_mep=confirm("Do you really want to delete this MEP and all the information associated with this MEP?");
	if(delete_prd_mep)
	{
		window.location.href="06indi02go89.php?show=view_prdno&action=Delete&id="+prd_mep_id+"&mep_no="+mep_no+"&url="+url;
	}
}
//function to ask for confirmation before removing the combination of category, modal, country
function delete_prd_sp(prd_sp_id,url)
{
	var delete_prd_mep=confirm("Do you really want to delete this record?");
	if(delete_prd_mep)
	{
		window.location.href="06indi02go89.php?show=view_prdno&action=Delete&sp_id="+prd_sp_id+"&url="+url;
	}
}
