
var flag = 0;
function regSource(ob) {
	if (ob.value == 'other') {
		flag = 1;
		new Insertion.After('source', ' <input type="text" name="other" id="other" value="Please specify" onclick="this.value=\'\'" />');
	}
	if (ob.value != 'other' && flag == 1) {
		$('other').remove();
		flag = 0;
	}
}

function forgotPassword() {
	window.location.href = 'http://www.bulgarianholidayrentals.co.uk/user/forgotpassword.php?' + $('login').serialize();
}



//calendar
var calendarObjForForm = new DHTMLSuite.calendar({minuteDropDownInterval:10,numberOfRowsInHourDropDown:5,callbackFunctionOnDayClick:'getDateFromCalendar',isDragable:true,displayTimeBar:true}); 
calendarObjForForm.setCallbackFunctionOnClose('myOtherFunction');
function myOtherFunction() 	{		
}

function pickDate(buttonObj,inputObject) {
		inputObject.value = "";
		calendarObjForForm.setCalendarPositionByHTMLElement(inputObject,0,inputObject.offsetHeight+2);	
		calendarObjForForm.setInitialDateFromInput(inputObject,'dd-mm-yyyy hh:ii');	
		calendarObjForForm.addHtmlElementReference('myDate',inputObject);	// just ref for me *
		if(calendarObjForForm.isVisible()){
			calendarObjForForm.hide();
		}else{
			calendarObjForForm.resetViewDisplayedMonth();	
			calendarObjForForm.display();
		}		
}	


function getDateFromCalendar(inputArray) {
	var references = calendarObjForForm.getHtmlElementReferences(); // get previous ref back *
	references.myDate.value = inputArray.day + '-' + inputArray.month + '-' + inputArray.year;
	calendarObjForForm.hide();	
}	

function addPeriod() {
	window.location.href = "addperiod.php?" + $('pictures').serialize(); 
}


