/******************************************
Module name : Js Function file
Parent module : None
Date created : 23th Jan 2008
Date last modified : 
Author :  Rupesh Parmar
Last modified by : 
Comments : The functions_js.js file contains various functions related to the web directory project.
******************************************/	

/******************************************
Function name : setDecimalValue
Return type : None
Date created : 23th Jan 2008
Date last modified : 
Author : Rupesh Parmar
Last modified by :
Comments: Function is used to set decimal values if the value does not contain decimal values it will add .00 the existing value.
User instruction : setDecimalValue()
******************************************/
function setDecimalValue(fieldID)
{
     var val = document.getElementById(fieldID).value;
	 if(val != '' )
	 {
		 if(!isNaN(val))
		 {
				 if(val.indexOf(".")<0)
				 {
					  document.getElementById(fieldID).value=val+'.00';
				 }
				else
				{
					var Rate = val.split(".");
					 var Decimal = Rate[1];
					 if(Decimal.length >= 2)
					 {
						document.getElementById(fieldID).value=val;
					 }
					else
					 {
						document.getElementById(fieldID).value=val+'0';
					  }
				}
		 }
	 }
}
/******************************************
Function name : showSearchBox
Return type : None
Date created : 23th Jan 2008
Date last modified : 
Author : Rupesh Parmar
Last modified by :
Comments : Function is used to show hide the seacch box
User instruction : showSearchBox()
******************************************/
function showSearchBox(varDocumentID, varShow)
{
	if(varShow == 'show')
	{
	 document.getElementById(varDocumentID).style.display = 'block';	
	}
	else
	{
	  document.getElementById(varDocumentID).style.display = 'none';
	}
	
}


/******************************************
Function name : toggleOption
Return type : None
Date created : 23th Jan 2008
Date last modified : 23th Jan 2008
Author : Rupesh Parmar
Last modified by :
Comments : Function will toggle the select all checkbox option.
User instruction : toggleOption(spanChk)
******************************************/

function toggleOption(spanChk)
{
	
	var xState=spanChk.checked;
	var theBox=spanChk;

	elm=theBox.form.elements;
	
	for(i=0;i<elm.length;i++)
	{
		if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
		{
			if(xState == false)
				elm[i].checked = false;
			else
				elm[i].checked = true;
		}
	}
}

/******************************************
Function name : checkPhone
Return type : boolean
Date created : 23th Jan 2008
Date last modified :  
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the true or false according to phone field validation
User instruction : checkPhone(phone)
******************************************/
function checkPhone(phone)
{
	var phoneRequired = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,3})|(\(?\d{2,3}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/
	if(!phoneRequired.test(phone))
		return false;
	return true;
}

/******************************************
Function name : getMasterString
Return type : boolean
Date created : 23th Jan 2008
Date last modified :  
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the main string
User instruction : getMasterString()
******************************************/
function getMasterString()
{
	return "Sorry, we can not complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n";
}

/******************************************
Function name : checkError
Return type : boolean
Date created : 23th Jan 2008
Date last modified : 23th Jan 2008
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the true or false acording to form validation
User instruction : checkError(error)
******************************************/
function checkError(error)
{
	var flag=false;
	var MasterString = getMasterString();
	
	if(error != "")
	{
		MasterString = MasterString + error;
		flag=true;
	}
	
	if(flag == true)
	{
		alert(MasterString);
		return false;
	}
	else
		return true;
}

/******************************************
Function name : askConfirm
Return type : boolean
Date created : 23th Jan 2008
Date last modified :  
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the true or false after asking for confirmation
User instruction : askConfirm(type)
******************************************/
function askConfirm(type)
{	
	var sen = "Are you sure you want to "+type+"?";
	if(confirm(sen))
		return true;
	else
		return false;
}

/******************************************
Function name : validator
Return type : boolean
Date created : 23th Jan 2008
Date last modified :  
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the true or error message after validating checkboxes
User instruction : validator(btnType)
******************************************/
var btnType;
function validator(btnType,formname)
{
	
	var obj = formname;
	var error="", flagCheck=0;
	
	var len = obj.elements.length; 
	var i=0;
	for(i=0;i<len;i++) 
	{
		if(obj.elements[i].type=='checkbox')
		{
			if(obj.elements[i].checked)
			{
				//if(btnType == 'Delete')
					return askConfirm(btnType);
				//else
					//return true;
			}
			else
				flagCheck = 1;
		}
	}
	
	if(flagCheck == 1)
		error += "\n - Please select at least one record.";
			
	return checkError(error);
}

/*****************************
Function name : dateCompare
Return type : boolean
Date created : 23th Jan 2008
Date last modified :  
Author : Rupesh Parmar
Last modified by :
Comments : This function is used to validate the date compare form and to date.[ From date should be less than to date. ]
User instruction : dateCompare(formname)
************************************/
function dateCompare(formname)
{
	
		   var sliptdate	= document.getElementById(formname).frmTodate.value.split("-");
		   var FromDate  = document.getElementById(formname).frmDate.value.split("-");
			/*********************** From Date *****************/
			var TY = FromDate[0];  //Year
			var TM = FromDate[1];  //Month
			var TD = FromDate[2];  //Date
			/******************* To Date *********************/
			var sY=sliptdate[0];  //Year
			var sM=sliptdate[1];  //Month
			var sD=sliptdate[2];  //Date
			
		if(document.getElementById(formname).frmDate.value != 'From' && document.getElementById(formname).frmTodate.value != 'To')
		{

			if(sY<TY ) {
				
				alert("'To' date should be greater than 'From' date.");
				return false;	  
			}
			else if(sM==TM && sD<TD && sY==TY) { 

				alert("'To' date should be greater than 'From' date.");
				return false;
				
			}
			else if(sM<TM && sY==TY) { 

				alert("'To' date should be greater than 'From' date.");
				return false;
				
			}
		}
	
}

/******************************************
Function name : validator
Return type : boolean
Date created : 23th Jan 2008
Date last modified : 23th Jan 2008
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the true or error message after validating checkboxes
User instruction : validator(btnType)
******************************************/
function validateForm() 
{ 
	var i,p,q,nm,test,num,min,max,errors='',args=validateForm.arguments;
	j=0;
	//	/^([-a-zA-Z0-9._]+@[-a-zA-Z0-9.]+(\.[-a-zA-Z0-9]+)+)$/;
	var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var regBlank = /[^\s]/;
	//var regSpace = /[\s]/;
	var regSpace = /^([a-zA-Z0-9_-]+)$/;
	//var regAlphaNum = /^([a-zA-Z0-9-/_ :;#!@\n\r.,$*&%?^~`=+(){}\[\]\"\'\\]+)$/;
	var regAlphaNum = /^([a-zA-Z0-9_#@]+)$/;
	 var regDate = /^([0-9_]+-[0-9][0-9]+-[0-9][0-9]+)$/; 
  	 var regChar = /^([a-zA-Z]+)$/;
	 var regNumeric = /^([0-9]+)$/; 
	 var regDecimal = /^([0-9.]+)$/; 
	
	//alert (validateForm.arguments[1].name);
	//alert("sss--->"+document.forms[""+args[0]].elements[""+args[0]].value);
	for (i=1; i<(args.length-2); i+=3) 
	{	
		mesg=args[i+1];
		test=args[i+2]; 
		val=document.forms[""+args[0]].elements[""+args[i]];
		
		if (val) 
		{	
			
			nm=mesg; 
			noVal = val;
			val = val.value;
			if(regBlank.test(val))
			{
				if(test.indexOf('isEqual')!=-1)
				{
					result = trim(val);

					if(result.length==0)
					{
											
					errors += '- '+nm+' is required.\n'; 
					}
					else
					{
					equal_obj_val = test.substring(8,test.indexOf(":"));
					mesg_string =test.substring((test.indexOf(":")+1));

						if(val != document.forms[""+args[0]].elements[""+equal_obj_val].value)
						{ 
							errors+='- '+nm+' and '+mesg_string+' must be same.\n';
						}
					}
				}
				else if(test.indexOf('isAlphaNum')!=-1)
				{
					result = trim(val);
					if(result.length==0){
					errors += '- '+nm+' is required.\n'; 
					}else{
						if(!regAlphaNum.test(val))
						{
							errors += '- '+nm+' is not valid.\n';
						}
					}
				
				}
				else if(test.indexOf('isNumeric')!= -1)
				{
						if(!regNumeric.test(val))
						{
							errors += '- '+nm+' must contain a numeric value.\n';
							
						}
				}
				else if(test.indexOf('isDecimal') != -1)
				{
					
					if(!regDecimal.test(val))
					{
						errors += '- '+nm+' must contain a number.\n';
					}
				}
				else if(test.indexOf('isSpace')!=-1)
				{
					result = trim(val);
					
					if(result.length==0)
					{
						errors += '- '+nm+' is required.\n'; 
					}
					else
					{
						if(!regSpace.test(val))
						{
							errors += '- '+nm+' is not valid.\n';
						}
					}
				}
				else if (test.indexOf('isEmail')!=-1) 
				{ 
					p=val.indexOf('@');
					s=val.indexOf('.');
			        if (p<1 || p==(val.length-1))
					{
						errors+='- '+nm+' must contain an e-mail Address.\n';
		
					}
					else if(!regEmail.test(val))
					{
						errors+='- '+nm+' must contain a valid e-mail Address.\n';
					}
			     }
				else if (test.indexOf('isUrl')!=-1) 
				{ 
					p=val.indexOf('http://');
					s=val.indexOf('.');
			        if (p<0 || p==(val.length-1))
					{
						errors+='- '+nm+' must be valid URL e.g. http://www.abc.com\n';
		
					}
					else if(s<p || s==(val.length-1))
					{
						errors+='- '+nm+' must be valid URL e.g. http://www.abc.com\n';
					}
			     }
				else if (test.indexOf('isChar')!=-1) 
				 { 
					var first_char;
					
					if(val.match(regChar)==null)
					{
					 	errors+='- '+nm+' must contain a character.\n';
					}
			     }
				else if(test.indexOf('isCheckbox')!=-1)//Check is check box is not checked generate error
				{	
					var valueCheckbox = noVal.checked;
					if(!valueCheckbox)
					{
						errors+='- '+' Accept terms and Policy.\n';
					}
				}
				else if (test.charAt(0)=='R')
				{
					result = trim(val);
					if(result.length==0){
						
					errors += '- '+nm+' is required.\n'; 
					}
				} 
			
		}
		else if (test.charAt(0)=='R')
		{
			result = trim(val);
				if(result.length==0){
					
				errors += '- '+nm+' is required.\n'; 
				}
		}
		
		if(errors !="")
		{	if(j<=0)
			{
				focusitem = document.forms[""+args[0]].elements[""+args[i]];
				j++;
			}	
		}
		}
		
	} 
	
  if (errors)
  {
	var MasterString = getMasterString();
	alert(MasterString+'\n'+errors);
	focusitem.focus();
	return false;
   }
   else
	return true;

  document.MM_returnValue = (errors == '');
}

/******************************************
Function name : stripHTML
Return type : string
Date created : 23th Jan 2008
Date last modified :  
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the main string after removing HTML tags
User instruction : stripHTML(str)
******************************************/
function stripHTML(str){
      var re= /<\S[^><]*>(&nbsp;)*/g ;
      return str.replace(re, "") ;
}
/******************************************
Function name : ltrim
Return type : string
Date created : 23th Jan 2008
Date last modified :  
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the main string after removing white spaces from the left
User instruction : ltrim(str)
******************************************/
function ltrim(str) { 
	for(var k = 0; k < str.length && isWhitespace(str.charAt(k)); k++);
	return str.substring(k, str.length);
}
/******************************************
Function name : rtrim
Return type : string
Date created : 23th Jan 2008
Date last modified :  
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the main string after removing white spaces from the right
User instruction : rtrim(str)
******************************************/
function rtrim(str) {
	for(var j=str.length-1; j>=0 && isWhitespace(str.charAt(j)) ; j--) ;
	return str.substring(0,j+1);
}
/******************************************
Function name : trim
Return type : string
Date created : 23th Jan 2008
Date last modified : 
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the main string after removing white spaces from the right and left of the main string
User instruction : trim(str)
******************************************/
function trim(str) {
	return ltrim(rtrim(str));
}
/******************************************
Function name : isWhitespace
Return type : integer
Date created : 23th Jan 2008
Date last modified : 23th Jan 2008
Author : Rupesh Parmar
Last modified by :
Comments : Function will return the index of white space encounter in the string.
User instruction : isWhitespace(charToCheck)
******************************************/
function isWhitespace(charToCheck) {
	var whitespaceChars = " \t\n\r\f";
	return (whitespaceChars.indexOf(charToCheck) != -1);
}

/*****************************
Function name : validateAdminForm
Return type : integer
Date created : 23th Jan 2008
Date last modified :  
Author : Rupesh Parmar
Last modified by :
Comments : This is used to check admin login authentications.
User instruction : validateAdminForm(charToCheck)
************************************/
function validateAdminForm(formname)
{
	if(validateForm(formname,'frmAdminUserName','Username','R', 'frmAdminPassword','Password','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}

/*****************************
Function name : validChangePass
Return type : integer
Date created : 23th Jan 2008
Date last modified :  
Author : Charanjeet Singh
Last modified by : Charanjeet Singh
Comments : This is used to validate admin password and confirm passwords.
User instruction : validChangePass(charToCheck)
************************************/
function validAdminChangePass(formname)
{
	if(validateForm(document.getElementById(formname).id,'frmAdminOldPassword', 'Current Password', 'RisSpace', 'frmAdminNewPassword', 'New Password','RisSpace','frmAdminConfirmPassword', 'Confirm New Password', 'RisEqualfrmAdminNewPassword:New Password'))
	{			
			var flag=confirm('Are you sure you want to change password?')
			if(flag)
			return true;
			
			else
			return false;		
	} 
	else 
	{
		return false;
	} 
}


/*****************************
Function name : validateLoginForm
Return type : none
Date created : 23th Jan 2008
Date last modified : 23th Jan 2008
Author : Rupesh Parmar
Last modified by :
Comments : This function is used to validate forgot password form.
User instruction : validateLoginForm(charToCheck)
************************************/
function validateLoginForm(formname)
{
	if(validateForm(formname,'frmUserName','Username','RisEmail','frmUserPassword','Password','R','frmSecurityCode','Verification code','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}

/*****************************
Function name : validateAdminEmailChange
Return type : none
Date created : 23th Jan 2008
Date last modified :  
Author : Rupesh Parmar
Last modified by :
Comments : This function is used to validate change password form. 
User instruction : validateLoginForm(charToCheck)
************************************/
function validateAdminEmailChange(formname)
{
	if(validateForm(document.getElementById(formname).id,'frmAdminEmail', 'Primary Email','RisEmail' , 'frmSecondavyAdminEmail', 'Primary Email' , 'isEmail' ))
	{			
			var flag=confirm('Are you sure you want to change email id?')
			if(flag)
			return true;
			
			else
			return false;		
	} 
	else 
	{
		return false;
	} 
}

/*****************************
Function name: validateSearhServicePrice
Return type: none
Date created: 21st January 2008
Date last modified: 21st January 2008
Author: Rupesh Parmar
Last modified by :
Comments: This function is used to validate the search service price form
User instruction:  validateSearhServicePrice(formname)
************************************/
function validateSearhServicePrice(formname)
{
	var error = '';
	var focusItems = '';
	var regNumeric = /^([0-9]+)$/; 
	var regDecimal = /^([0-9]+\.?[0-9]+)$/;
	
	//variable that are used for date compare
	var sliptdate	= document.getElementById(formname).frmTodate.value.split("-");
	var FromDate  = document.getElementById(formname).frmDate.value.split("-");
	/*********************** From Date *****************/
	var TY = FromDate[0];  //Year
	var TM = FromDate[1];  //Month
	var TD = FromDate[2];  //Date
	/******************* To Date *********************/
	var sY=sliptdate[0];  //Year
	var sM=sliptdate[1];  //Month
	var sD=sliptdate[2];  //Date
		 
	//code to check service price
	if(trim(document.getElementById(formname).frmSearchServicePrice.value) != '' && trim(document.getElementById(formname).frmSearchServicePriceCompare.value) == '')
	{
	
		error +='\n- Please Select Service Price Criteria.';
	}
	if(error != '' && focusItems == '')
	{
		focusItems = document.getElementById(formname).frmSearchServicePriceCompare;
	}			
	if(trim(document.getElementById(formname).frmSearchServicePriceCompare.value) != '' && trim(document.getElementById(formname).frmSearchServicePrice.value) == '')
	{
	
		error +='\n- Please Enter Service Price.';
	}
	if(trim(document.getElementById(formname).frmSearchServicePrice.value) != '' && !regDecimal.test(trim(document.getElementById(formname).frmSearchServicePrice.value)))
	{
	
		error +='\n- Service Price must contain a number.';
	}			
	
	if(error != '' && focusItems == '')
	{
		focusItems = document.getElementById(formname).frmSearchServicePrice;
	}
	//Code to check No of Pages	
	if(trim(document.getElementById(formname).frmSearchNoOfPages.value) != '' && trim(document.getElementById(formname).frmSearchNoOfPagesCompare.value) == '')
	{
	
		error +='\n- Please Select No Of Pages Criteria.';
	}
	if(error != '' && focusItems == '')
	{
		focusItems = document.getElementById(formname).frmSearchNoOfPagesCompare;
	}			
	if(trim(document.getElementById(formname).frmSearchNoOfPagesCompare.value) != '' && trim(document.getElementById(formname).frmSearchNoOfPages.value) == '')
	{
	
		error +='\n- Please Enter No Of Pages.';
	}
	if(trim(document.getElementById(formname).frmSearchNoOfPages.value) != '' && !regNumeric.test(trim(document.getElementById(formname).frmSearchNoOfPages.value)))
	{
	
		error +='\n- No Of Pages must contain a numeric value.';
	}			
	if(error != '' && focusItems == '')
	{
		focusItems = document.getElementById(formname).frmSearchNoOfPages;
	}
	//Code to  No Of Days criteria.
	if(trim(document.getElementById(formname).frmSearchNoOfDays.value) != '' && trim(document.getElementById(formname).frmSearchNoOfDaysCompare.value) == '')
	{
	
		error +='\n- Please Select No Of Days Criteria.';
	}
	if(error != '' && focusItems == '')
	{
		focusItems = document.getElementById(formname).frmSearchNoOfDaysCompare;
	}			
	if(trim(document.getElementById(formname).frmSearchNoOfDaysCompare.value) != '' && trim(document.getElementById(formname).frmSearchNoOfDays.value) == '')
	{
	
		error +='\n- Please Enter No Of Days.';
	}
	if(trim(document.getElementById(formname).frmSearchNoOfDays.value) != '' && !regNumeric.test(trim(document.getElementById(formname).frmSearchNoOfDays.value)))
	{
	
		error +='\n- No Of Days must contain a numeric value.';
	}			
	if(error != '' && focusItems == '')
	{
		focusItems = document.getElementById(formname).frmSearchNoOfDays;
	}
		//date compare
	if(document.getElementById(formname).frmDate.value != 'From' && document.getElementById(formname).frmTodate.value != 'To')
	{
		if(sY<TY )
		{
			error += "\n-'To' date should be greater than 'From' date.";
		}
		else if(sM==TM && sD<TD && sY==TY)
		{ 
			error += "\n-'To' date should be greater than 'From' date.";
		}
		else if(sM<TM && sY==TY)
		{ 
			error += "\n-'To' date should be greater than 'From' date.";
		}
	}
	//end date compare
	if(error != '')
	{
		checkError(error);
		if(focusItems != '')
		{
		  focusItems.focus();
		}
		return false;
	}
	else
	{
		return true;
	}
}

function validateSubscription(formname)
{
	if(validateForm(document.getElementById(formname).id,'frmSubscriberName','Subscriber Name','R','frmSubscriberEmail','Subscriber Email','RisEmail'))
	{	
		return true;
	} 
	else 
	{			
		return false;
	} 	
}

function deSelectCheckbox(formname)
{
	document.getElementById('Main').checked = false;
}

function setValidAction(value, formname, listname)
{
	
	if(value == 'Delete')
	{
		message = "delete selected "+listname;		
	}
	else
	{
		message = "change status of selected "+listname;
	}
	var flag = validator(message,formname);			
	if(flag)
	{			
		formname.submit();
	}
	else
	{
		formname.frmChangeAction.value='';	
		document.getElementById('Main').checked = false;
		document.forms[1].Main.checked=false;				
		elm=document.forms[1].elements;
		for(i=0;i<elm.length;i++)
		{
			if(elm[i].type=="checkbox")
			{			
				elm[i].checked = false;
			}
		}
		return false;
	}
}

function validateHotelForm(formname)
{
	if(validateForm(formname,'frmfkLocationID','Location','R','frmHotelTitle','Title','R' , 'frmHotelStreetAddress' , 'Street Address', 'R', 'frmHotelCity', 'City', 'R' , 'frmHotelState' ,'State' ,'R', 'frmHotelZipCode', 'Zip Code', 'R', 'frmHotelPageUrl','Page Url', 'RisSpace'))
	{	
		return true;
	} 
	else 
	{			
		return false;
	} 	
}
function validateApplyFor(formname)
{
	
	if(validateForm(formname, 'frmpkHotelID', 'Hotel Title', 'R','frmDeptDate', 'Dept Date', 'R', 'frmSubject','Subject','R','frmName','Name','R' , 'frmEmail' , 'Email', 'RisEmail', 'frmPhone', 'Phone', 'R' ))
	{	
		return true;
	} 
	else 
	{			
		return false;
	} 	
}

function addMoreImage(valCount)
{  

     
	var obj = document.getElementById("hotelImageForm");
	var valCount = parseInt(valCount);
	//alert(valCount);
	//if(obj.packageCountCheck.value<valCount)
	{
		obj.totalDiv.value = parseInt(obj.totalDiv.value) + 1;
		var newVal = obj.totalDiv.value;
		obj.packageCountCheck.value = parseInt(obj.packageCountCheck.value) + 1;
		varVal = obj.packageCountCheck.value;
		//alert(varVal);
		
		var content = '<div id="id_'+newVal+'" style="width:400px; float:left; margin-bottom:15px; padding:0;  margin:0;"><div style="width:400px;float:left;"><div style="width:350px; float:left; padding:0; margin:0; padding-bottom:10px;"><input name="attachFile'+varVal+'" type="file" size="40" style="padding:0; margin:0; width:350px;" /></div><div style="width:30px;  float:left;"><a href="javascript: removeMoreImage('+newVal+');"><img src="./images/remove_file.gif" alt="Remove image" title="Remove image" /></a></div></div></div>';
		//alert(content)
		
		document.getElementById("moreFile").style.display = "block";
		dynamiccontentNSImage("moreFile", content);
	}


}

/******************************************
Function Name : dynamiccontentNS6(elementid, content)
Return Type : boolean
Date Created : 27th July 2007
Date Last Modified : 27th July 2007
Author :Bharat Bhushan
Last Modified By :Bharat Bhushan
Comments : Function will add more file
User Instruction : dynamiccontentNS7 
******************************************/
function dynamiccontentNSImage(elementid, content)
{
	if(document.all)
	{ 
		el = document.getElementById(elementid);
		el.innerHTML += content;
	}
	else if(document.getElementById)
	{
		rng = document.createRange();
		el = document.getElementById(elementid);
		rng.setStartBefore(el);
		htmlFrag = rng.createContextualFragment(content);
		el.appendChild(htmlFrag);
	}
}

/******************************************
Function Name : removeMoreFile
Return Type : boolean
Date Created : 27th July 2007
Date Last Modified : 27th July 2007
Author :Bharat Bhushan
Last Modified By :Bharat Bhushan
Comments : Function will add more file
User Instruction : removeMoreFile 
******************************************/

function removeMoreImage(id)
{    
     
     var obj = document.getElementById("hotelImageForm");
	
	varval= obj.packageCountCheck.value = parseInt(obj.packageCountCheck.value) - 1; 
	document.getElementById('id_'+id).style.display = 'none';
	document.getElementById('id_'+id).innerHTML = '';
}


/******************************************
Function Name : delModel
Return Type : boolean
Date Created : 4 sep 2007
Date Last Modified : 4 sep 2007
Author :Bharat Bhushan
Last Modified By :Bharat Bhushan
Comments : Function will delete model images
User Instruction :  delModel(argId,argType,pkID)
******************************************/

function delHotelImage(argID, argHID)
{    
	if(confirm('Are you sure you want to remove the hotel image?'))
	{
		location.href = 'admin_action_uil.php?type=delHotelImage&pkHotelImageID='+argID+'&hID='+argHID;
	}
	else
	{
		return false;	
	}
}

function full_image(path,title,w,h)
{
	window.open(path,""+title,"width="+w+",height="+h); 
}

//Show full description
function doOpen(id)
{
	if(document.getElementById('content'+id).style.display == 'block')
	{
		if(document.getElementById('content'+id))	
		{
			document.getElementById('content'+id).style.display = 'none';
			document.getElementById('initContent'+id).style.display = 'block';
			document.getElementById('img'+id).innerHTML = '<img src="common/images/plus.jpg" class="icon" />';
		}
	}
	else
	{
		hideAll();
		if(document.getElementById('content'+id))	
		{
			document.getElementById('content'+id).style.display = 'block';
			document.getElementById('initContent'+id).style.display = 'none';
			document.getElementById('img'+id).innerHTML = '<img src="common/images/minus.jpg" class="icon" />';
		}
	}
}


function hideAll()
{
	//alert(document.getElementById('frmHide').totalCnt.value);
	cnt = document.getElementById('frmHide').totalCnt.value;
	for(i=1;i<=cnt;i++)
	{
		if(document.getElementById('content'+i))	
		{
			document.getElementById('content'+i).style.display = 'none';
			document.getElementById('initContent'+i).style.display = 'block';
			document.getElementById('img'+i).innerHTML = '<img src="common/images/plus.jpg" class="icon" />';
		}
	}
}