/*++++++++++++++++++++++++++++++++++++++++++++++++++++++/
/ JavaScript functions for this whole website           / 
/  Made by : Abhishek Sarkar                            /  
/  Companey : Jayanth Systems                           /
/  Year : 2006                                          /
+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

// -----------------------Common Functions-----------------------------------------
 
function chkLogout(){
	if(confirm("Do you want to logged out ?")){
		document.frm_logout.submit();
	}
	else
	window.history.go(1);
}
function backto(){
	document.frm.pageaction.value="";
	document.frm.submit();
}
function navig(off_set){
	document.frm.offset.value=off_set;
	document.frm.submit();
}
function navigUser(off_set){
	document.frm.offset.value=off_set;
	document.frm.submit();
}
function alphabates(alp){
	document.frm.alpha.value=alp;
	document.frm.offset.value=0;
	document.frm.submit();
}

function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function gotoFeaturedCar(id){
	document.frm.pageaction.value="setFeature";
	document.frm.submit();
}
function gotoInShowcase(id){
	document.frm.pageaction.value="inShowcase";
	document.frm.submit();
}
function displayMessage(msg)
{
	alert(msg);
}

//--------------check select row----------------------------------------------------
var selected;
function selectRowEffect(object, path) {
 
  if (!selected) {
    if (document.getElementById) {
      selected = document.getElementById('defaultSelected');
    } else {
      selected = document.all['defaultSelected'];
    }
  }
  if (selected) selected.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected = object;
  if(path)
  	location=path;
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}


//--------------check integer----------------
function isInteger(sInt)
	{
		var ret_int = "true"
		inputInt = sInt.toString()
		for (var i = 0; i < inputInt.length; i++)
			{
			var oneChar = inputInt.charAt(i)			
			if ((oneChar < "0" || oneChar > "9") && oneChar != ".")
					{
						ret_int = "false"
					}
			}
		return (ret_int)
	}
//--------------check date----------------
function isDate(sDate){
	var ret_dt = "true"
	inputDt = sDate.toString()		
	if((/^\d{4}\-\d{2}\-\d{2}$/).exec(inputDt) == null){ //-- date format--->(Y-m-d)
		ret_dt = "false"
	}
	return (ret_dt)
}
//--------------check email----------------
function isEmail(sEmail){
	var ret_email = "true"
	inputEml = sEmail.toString()		
	if((/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z]{2,5}$/).exec(inputEml) == null){
		ret_email = "false"
	}
	return (ret_email)
}

//--------------check blanck----------------
function isBlank(sVal){
	var ret_msg = "true"
	inputStr = sVal.toString()		
	if(inputStr.search(/\S/)==-1){ //-- check for space also
		ret_msg = "false"
	}
	return (ret_msg)
}

//******************************************************  USER FUNCTIONS   *****************************************************
function gotoAdd(){
	document.frm.pageaction.value="add";
	document.frm.submit();
}
function gotoAddPtoC(id){
	document.frm.cm_id.value=id;
	document.frm.pageaction.value="add";
	document.frm.submit();
}
function gotoUploadBill(){
	document.frm.pageaction.value="uploadScreen";
	document.frm.submit();
}

function gotoUpdateProductDetl(cid, psid){
	document.frm.cm_id.value=cid;
	document.frm.ps_id.value=psid;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}

function gotoAddNewBillName(){
	document.frm.pageaction.value="add";
	document.frm.submit();
}

function gotoUpdatebilling(id){
	document.frm.billing_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoDeletebilling(id){
	if(confirm("Want to delete this Billing?"))
	{
		document.frm.billing_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoAddbilling(){
	document.frm.pageaction.value="add";
	document.frm.submit();
}

function gotoUpdateStatus(id){
	document.frm.status_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoShowRemarks(id){
	document.frm.ps_id.value=id;
	document.frm.pageaction.value="detl";
	document.frm.submit();
}

function gotoDeleteStatus(id){
	if(confirm("Want to delete this Status?"))
	{
		document.frm.status_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoAddStatus(){
	document.frm.pageaction.value="add";
	document.frm.submit();
}


function gotoUpdatebill(id){
	document.frm.bill_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoDeletebill(id){
	if(confirm("Want to delete this bill?"))
	{
		document.frm.bill_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoShowProductDetails(psid){
	document.frm.ps_id.value=psid;
	document.frm.submit();
}

function gotoSearchVoucher(){
	if(document.getElementById("vm_pin").value!=''){
		document.frm.pageaction.value="search";
		document.frm.submit();
	}
	else{
		alert("Enter search value!!");
		document.getElementById("vm_pin").focus();
	}
}

function gotoSearchCustProduct(){
	if(document.getElementById("cm_idno").value!='' || document.getElementById("cm_fname").value!=''){
//		alert(document.getElementById("reg_no").value); 
		document.frm.pageaction.value="search";
		document.frm.submit();
	}
	else{
		alert("Enter search value!!");
		document.getElementById("cm_idno").focus();
	}
}

function gotoSearchProductReport(){
	if(document.getElementById("from_date").value!='' || document.getElementById("to_date").value!=''){
//		alert(document.getElementById("reg_no").value); 
		document.frm.pageaction.value="search";
		document.frm.submit();
	}
	else{
		alert("Enter search value!!");
		document.getElementById("from_date").focus();
	}
}

function gotoUpdateUser(id){
	document.frm.aw_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateNotice(id){
	document.frm.nm_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdatePoem(id){
	document.frm.pn_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdatePoemE(id){
	document.frm.pe_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateDetlTel(id){
	document.frm.sl_no.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}

function gotoUpdateStory(id){
	document.frm.ssn_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateStoryEnglish(id){
	document.frm.sse_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateAntarbartaNepali(id){
	document.frm.an_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateInterviewEnglish(id){
	document.frm.ie_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateJibaniNepali(id){
	document.frm.jn_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}

function gotoUpdateNewsNepali(id){
	document.frm.nn_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateNewsEnglish(id){
	document.frm.ne_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}

function gotoUpdatePhotographs(id){
	document.frm.pd_sl.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}

function gotoUpdateMember(id){
	document.frm.mm_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateFeedback(id){
	document.frm.vf_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdatePersonalitiesEnglish(id){
	document.frm.pe_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateBookReviewNepali(id){
	document.frm.brn_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateWeather(id){
	document.frm.sl_no.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateAntabarta(id){
	document.frm.an_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateNM(id){
	document.frm.nmn_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateSamalochona(id){
	document.frm.sn_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateEditorial(id){
	document.frm.ed_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateEssay(id){
	document.frm.ee_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateNibandha(id){
	document.frm.nn_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoUpdateSector(id){
	document.frm.sm_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}

function gotoUpdatePCat(id){
	document.frm.pc_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}

function gotoUpdateProduct(id){
	document.frm.pm_id.value=id;
	document.frm.pageaction.value="edit";
	document.frm.submit();
}
function gotoShowProduct(id){
	document.frm.cm_id.value=id;
	document.frm.pageaction.value="showproduct";
	document.frm.submit();
}

function gotoDeleteUser(id){
	if(confirm("Want to delete this award?"))
	{
		document.frm.aw_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeleteNotice(id){
	if(confirm("Want to delete this notice / advertisement?"))
	{
		document.frm.nm_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeletePoem(id){
	if(confirm("Want to delete this poem?"))
	{
		document.frm.pn_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeletePoemE(id){
	if(confirm("Want to delete this poem?"))
	{
		document.frm.pe_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeleteDetlTel(id){
	if(confirm("Want to delete this record?"))
	{
		document.frm.sl_no.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeleteStory(id){
	if(confirm("Want to delete this story?"))
	{
		document.frm.ssn_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeleteStoryEnglish(id){
	if(confirm("Want to delete this story?"))
	{
		document.frm.sse_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeleteAntarbartaNepali(id){
	if(confirm("Want to delete this antarbarta?"))
	{
		document.frm.an_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeletePhoto(id){
	if(confirm("Want to delete this photograph?"))
	{
		document.frm.photopath.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeletePhotographs(id){
	if(confirm("Want to delete this photograph?"))
	{
		document.frm.pd_sl.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeleteInterviewEnglish(id){
	if(confirm("Want to delete this interview?"))
	{
		document.frm.ie_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeleteJibaniNepali(id){
	if(confirm("Want to delete this jibani?"))
	{
		document.frm.jn_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeleteNewsNepali(id){
	if(confirm("Want to delete this news?"))
	{
		document.frm.nn_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeleteNewsEnglish(id){
	if(confirm("Want to delete this news?"))
	{
		document.frm.ne_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeleteMember(id){
	if(confirm("Want to delete this member?"))
	{
		document.frm.mm_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeleteFeedback(id){
	if(confirm("Want to delete this feedback?"))
	{
		document.frm.vf_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeletePG(id){
	if(confirm("Want to delete this photo from gallery?"))
	{
		document.frm.pg_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}


function gotoDeletePersonalitiesEnglish(id){
	if(confirm("Want to delete this personalities?"))
	{
		document.frm.pe_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeleteBookReviewNepali(id){
	if(confirm("Want to delete this book review?"))
	{
		document.frm.brn_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeleteAntarbarta(id){
	if(confirm("Want to delete this?"))
	{
		document.frm.an_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeleteNM(id){
	if(confirm("Want to delete this?"))
	{
		document.frm.nmn_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeleteSamalochona(id){
	if(confirm("Want to delete this?"))
	{
		document.frm.sn_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeleteEditorial(id){
	if(confirm("Want to delete this editorial?"))
	{
		document.frm.ed_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoDeleteEssay(id){
	if(confirm("Want to delete this essay?"))
	{
		document.frm.ee_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}
function gotoDeleteNibandha(id){
	if(confirm("Want to delete this?"))
	{
		document.frm.nn_id.value=id;
		document.frm.pageaction.value="delete";
		document.frm.submit();
	}
}

function gotoAddUser(){
	document.frm.pageaction.value="add";
	document.frm.submit();
}


