function showPersonalInfo(){
	if(document.getElementById('vuser_changepass'))
		return document.getElementById('vuser_changepass').checked
	else
		return null
}

var formLO=null;
var formLO2=null;
var formKML=null;
	
	function loginform(oresform,oresponseEl)
	{
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccess,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebug//,

			//busyContainer: oresponseEl
		});
		
		
	}
	
	
	function formRvalidfunc(oform,ocontainer){
		
		
		var Checkform='Y';
		inputInd=0;	
		var outputDiv = document.getElementById(ocontainer+'_error');
		
		while(oform.getElementsByTagName('input')[inputInd])
		{		
			var winput=oform.getElementsByTagName('input')[inputInd];
			if(winput.name.split('substartdate',1) == 'v'){
				if(winput.value>=startDate && winput.value<=endDate){
				}
				else{
					Checkform='N';
					if(outputDiv != null)
					{
						outputDiv.innerHTML = "subscribe date"+winput.name+"=="+winput.name.split('vsubstartdate');
						outputDiv.style.display = "block";
					}
					
				}
			}
			inputInd++;
		}
		
		if(document.getElementById('vuser_pass') && document.getElementById('vuser_repass')){
			
				if(document.getElementById('vuser_pass').value!=document.getElementById('vuser_repass').value){
					
		
					if(outputDiv != null)
					{
						outputDiv.innerHTML = " 'Password' and 'Retype Password' fields must have same value";
						outputDiv.style.display = "block";
					}
					Checkform='N';
				}
			
			
		}
		
		
		if(document.getElementById('vuser_email') && document.getElementById('vuser_reemail')){
			
				if(document.getElementById('vuser_email').value!=document.getElementById('vuser_reemail').value){
					var outputDiv = document.getElementById(ocontainer+'_error');
		
					if(outputDiv != null)
					{
						outputDiv.innerHTML = "'E-mail' and 'Retype E-mail' fields must have same value";
						outputDiv.style.display = "block";
					}
					Checkform='N';
				}
			
		}
		//alert(Checkform);
		if(Checkform=='Y'){
			indicatorCREATE(ocontainer);
			checkFormConvert(oform.id);	
			return true;
		}
		else{
			return false;
		}
	}
	
	function registerform(oresform,oresponseEl)
	{
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formRvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccess,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebugnohis//,

			//busyContainer: oresponseEl
		});
		
		
	}
	
	
	function registerformBk(oresform,oresponseEl)
	{
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formRvalidfunc,
			submitErrorFunc: testErrOutput,
			//asyncSubmitFunc: myOnSuccess,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebugnohis//,

			//busyContainer: oresponseEl
		});
		
		
	}
	
	function registerform2(oresform,oresponseEl)
	{
		formLO2 = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formRvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccess,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebugnohis//,

			//busyContainer: oresponseEl
		});
		
		
	}
	
	function loginform1(oresform,oresponseEl)
	{
		
		formLO2 = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccess,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebugnohis//,

			//busyContainer: oresponseEl
		});
		
		
	}
	
	function loginform2(oresform,oresponseEl,otheme)
	{
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccess,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebug,
			theme: otheme//,
			//busyContainer: oresponseEl
		});
		
		
	}
	
	function loginform3(oresform,oresponseEl,otheme)
	{
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccess,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebugnohis,
			theme: otheme//,
			//busyContainer: oresponseEl
		});
		
		
	}
	function myOnSuccessFile(ocallbackArgs) 
	{
		
		if(loader['fileListTD'])
			loader['fileListTD'].stop();
		
	//	alert(ocallbackArgs);
		simplepage(vsubpath+'/issys/filelist.php','GET','fileListTD',ocallbackArgs,'fileListTD','true');
	}
	
	
	function myOnSuccessPHOTO(ocallbackArgs) 
	{
	
		if(loader['postphotoTD'])
			loader['postphotoTD'].stop();
		
	//	alert(ocallbackArgs);
		simplepage(vsubpath+'/isnpdc/subscribepage.php','GET','webmain_pid',ocallbackArgs,'webmain_pid','true');
	}
	
	
	function myOnSuccessPAPER(ocallbackArgs) 
	{
		//alert('myOnSuccessKML');
		if(loader['webmain_pid'])
			loader['webmain_pid'].stop();
		
		
		simplepage(vsubpath+'/isnpdc/addpaper.php','POST','webmain_pid',ocallbackArgs,'webmain_pid','false');
	}
	
	function myOnSuccessKMLfiles(ocallbackArgs) 
	{
		//alert('myOnSuccessKMLfiles');
		if(loader['courseAddEditTD'])
			loader['courseAddEditTD'].stop();
		
		
		simplepage(vsubpath+'/isnpdc/course_kml.php','GET','coursekmlTD',ocallbackArgs,'coursekmlTD','false');
	}
	
	function loginformPAPER(oresform,oresponseEl)
	{
		formLO =null;
		formLO = Zapatec.Form.setupAll({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccessPAPER,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebug,
			serverCallback: "callback"//,
			
			//busyContainer: oresponseEl
		});
	}
	
	function myOnSuccessPHOTO2(ocallbackArgs) 
	{
	
		if(loader['postphotoTD'])
			loader['postphotoTD'].stop();
		
	//	alert(ocallbackArgs);
		simplepage(vsubpath+'/isnpdc/editionpage.php','GET','webmain_pid',ocallbackArgs,'webmain_pid','true');
	}
	
	function loginformPhoto2(oresform,oresponseEl,otheme)
	{
		
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccessPHOTO2,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebugnohis,
			serverCallback: "callback"//,				
			///busyContainer: oresponseEl
		});

	}
	
	function formKMLfiles(oresform,oresponseEl)
	{
		formKML=null;
		formKML = Zapatec.Form.setupAll({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccessKMLfiles,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebug,
			serverCallback: "callback"//,			
			//busyContainer: oresponseEl
		});
	}
	
	
	function loginform5(oresform,oresponseEl,otheme)
	{
		formLO = Zapatec.Form.setupAll({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccessFile,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebug,
			serverCallback: "callback"//,			
			//busyContainer: oresponseEl
		});
	}
	function loginform6(oresform,oresponseEl,otheme)
	{
		
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccessFile,
			ajaxDebugElement: oresponseEl,
			serverCallback: "callback"
		});
		
		
		
	}
	
	
	
	
	function loginformPhoto(oresform,oresponseEl,otheme)
	{
		
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccessPHOTO,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebugnohis,
			serverCallback: "callback"//,				
			///busyContainer: oresponseEl
		});

	}
	
	
	function LangSelect(olang){
	
		Zapatec.Utils.writeCookie('web_lang',olang);
	}
	
	function jsfileview(oreqid,oval){
		
		Zapatec.Utils.writeCookie('fileView'+oreqid,oval);
	}
	
	function jsimageview(oreqid,oval){
		
		//alert(oreqid+','+oval);
		Zapatec.Utils.writeCookie('imameView'+oreqid,oval);
	}
	
	function phoneselect(oval){
		
		Zapatec.Utils.writeCookie('phoneid',oval);
	}
	
	function creacookie(oname,oval){		
		Zapatec.Utils.writeCookie(oname,oval);
	}
	
	function webMenuOnClick(oitem){
		//alert(oitem.id);
		var itemLink=oitem.getElementsByTagName('a');
		if(itemLink&&itemLink.item(0)&&itemLink.item(0).getAttribute('onISclick')){
				
			
			
			
			 Zapatec.Transport.setInnerHtml({
			  html: '<scr'+'ipt type="text/javascript">'+itemLink.item(0).getAttribute('onISclick')+'</'+'script>',
			  container: 'testscriptTD'
			});
			
			if(typeof(anonymous)=="function"){
				anonymous();
			
			}
		}
		if(document.getElementById(Zapatec.Utils.getCookie('web_mainpath')))
		{
			var oldoItem=document.getElementById(Zapatec.Utils.getCookie('web_mainpath'));
			Zapatec.Utils.removeClass(oldoItem,"zpMenuPath");
		
		}
	
		Zapatec.Utils.addClass(oitem,"zpMenuPath");
	
		Zapatec.Utils.writeCookie('web_mainpath',oitem.id);
		
	}
	
	var menu=[];
	function  openmymenu(othemename,omenuname,overtical)
	{		
		menu[omenuname]=null;
		if(omenuname=='MenuTriBottom')
			menu[omenuname] = new Zapatec.Menu({theme: othemename,vertical: overtical,myonClick:webMenuOnClick, source: omenuname, rememberPath: 'expand', pathCookie: 'web_mainpath', slide: true,slidetype: 'bottom',hideDelay: 2, showDelay: 5, fade: true, zIndex:999});
		else
		if(omenuname=='MenuTriTopddd')
			menu[omenuname] = new Zapatec.Menu({theme: othemename,vertical: overtical,myonClick:webMenuOnClick, source: omenuname, rememberPath: 'expand', pathCookie: 'web_mainpath', slide: true,slidetype: 'top',hideDelay: 2, showDelay: 7,  zIndex:999});
		else
			menu[omenuname] = new Zapatec.Menu({theme: othemename,vertical: overtical,myonClick:webMenuOnClick, source: omenuname, rememberPath: 'expand', pathCookie: 'web_mainpath'});
		
		
		
	}



		function bascet()
		{
			this.name = new Array();
			this.service = new Array();				
			//this.price = new Array();
			this.account = new Array();
			this.parameter = new Array();
			this.status = new Array();
			this.serCodes = new Array();
			this.count=0;
			this.totalC=0;
			//this.totalprice=0;
			
		}
		
	
		
		bascet.prototype.prolist = function () 
		{	
			var listsend='';
			lp=0;
			for(k=0;k<this.totalC;k++)
			{
				if(document.getElementById('bask5678_' + this.service[this.serCodes[k]])){
				
					listsend+='&vcode'+lp+'='+this.service[this.serCodes[k]]+'&vname'+lp+'='+this.name[this.serCodes[k]];
					lp++;
				}
				
			}
			listsend+='&vlistnum='+lp;
			return listsend;
			
		};
		
		bascet.prototype.add = function (inname,inservice,inaccount,inparameter,instatus)
		{
			if(!this.service[inservice])
				this.count = this.count+1;
			this.name[inservice] = inname;
			this.service[inservice] = inservice;	
		
			//this.price[inservice] = inprice;
			this.account[inservice] = inaccount;
			this.parameter[inservice] = inparameter;			
			this.status[inservice] = instatus;	
			
			//if(inprice>0)
				//this.totalprice=this.totalprice*1+inprice*inaccount;
			
			
			if(!document.getElementById('bask5678_' + inservice))
			{
				this.serCodes[this.totalC] = inservice;
				this.totalC++;
				var cindiv = document.getElementById('bascetDIV');
				var newdiv = document.createElement('div');
				newdiv.id = 'bask5678_' + inservice;
				newdiv.innerHTML='<img src="'+vsubpath+'/ispages/isimage/isdesign/mainicon.jpg" width="7" height="7" />&nbsp;&nbsp;'+inname;
				newdiv.className="polltext";
				cindiv.appendChild(newdiv);
			}
		};
		
		bascet.prototype.remove = function (inservice)
		{
			
			if(this.service[inservice])
				this.count = this.count-1;
			this.name[inservice] = null;
			this.service[inservice] = null;
			//this.deckription[inservice] = null;
			//this.price[inservice] = null;
			this.account[inservice] = null;
			this.parameter[inservice] = null;
			this.status[inservice] = null;	
			
			if(document.getElementById('bask5678_' + inservice))
			{
				var cindiv = document.getElementById('bascetDIV');
				var newdiv = document.getElementById('bask5678_' + inservice);
			
				cindiv.removeChild(newdiv);
			}
		};
		
		
		bascet.prototype.td_count = function ()
		{
			
				document.getElementById('basket_TD').innerHTML=this.count;
				
		};
		
		
		
		var myBascet = new bascet();
		

		
		
	
	function usercheckFunc(ovalue){
		if(document.getElementById('all_checkDIV'))
			document.getElementById('all_checkDIV').style.display="none";
		if(document.getElementById('group_checkDIV'))
			document.getElementById('group_checkDIV').style.display="none";
		if(document.getElementById('user_checkDIV'))
			document.getElementById('user_checkDIV').style.display="none";
		
		document.getElementById(ovalue+'_checkDIV').style.display="block";
	}
	
	
	function formemailcheck(){
		if(document.getElementById('vuser_email').value!=document.getElementById('vuser_reemail').value){
			var outputDiv = document.getElementById(ocontainer+'_error');

			if(outputDiv != null)
			{
				outputDiv.innerHTML = "Re e-mail!=e-mail";
				outputDiv.style.display = "block";
			}
			return false
		}
	}
	
	var fileobjSource;
	var	fileobjTabs;
	
	function infoFiletabCrea(oname1,oname2,oname3,oname4,osend)
	{	
		
		fileobjSource=null;
		fileobjTabs=null;
		//osend='vmet_id=45&vmet_main=1&vfile=music';
		
		
		fileobjSource = {
		  tabs: [
			
			{
			  id: 'newtabFile',
			  linkInnerHTML: oname2,
			  accessKey: 't',
			  title: oname3,
			  url: vsubpath+'/isnpdc/tabcontent.php?vtype=new&'+osend
			},
			{
			  id: 'topscoreTabFile',
			  linkInnerHTML: oname1,
			  accessKey: 's',
			  title: oname1,
			  
			  url: vsubpath+'/isnpdc/tabcontent.php?vtype=topscore&'+osend
			},
			{
			  id: 'topdowntabFile',
			  linkInnerHTML: oname3,
			  accessKey: 'w',
			  title: oname3,
			  url: vsubpath+'/isnpdc/tabcontent.php?vtype=topdown&'+osend
			},
			{
			  id: 'allTabFile',
			  linkInnerHTML: oname4,
			  accessKey: 'w',
			  title: oname4,
			  url: vsubpath+'/isnpdc/tabcontent.php?vtype=all&'+osend
			}
		  ]
		};
		fileobjTabs = new Zapatec.Tabs({
		  tabBar: 'tabTopBarlang',
		  tabs: 'tabTopInfo',
		  source: fileobjSource,
		  sourceType: 'json',
		  theme: 'rounded',
		  themePath: vsubpath+'/isimage/tab/'
		});
	}
	
	
	//var fileTopobjSource;
	var	fileTopobjTabs;
	
	function infoFiletabDown()
	{	
		//fileTopobjSource=null;
		fileTopobjTabs=null;

		
		
		
		fileTopobjTabs = new Zapatec.AccordionTabs({
		//  tabBar: 'tabTopBarDown',
		  tabs: 'tabInfoDown',
		//  source: fileTopobjSource,
		//  sourceType: 'json',
		  theme: 'default',
		  themePath: vsubpath+'/isimage/tab/'
		});
	}
	
	
	
	var iframeWinWeb = [];

	function openwinTreeWeb(omet_id,ourl,ofile_id)
	{
		
		//jsimageview(ofile_id,"yes");		
		if(iframeWinWeb[omet_id]==null){	
		iframeWinWeb[omet_id] = Zapatec.Window.setup({
			left:150, 
			top:200, 
			width:300,
			height:400,
			showStatus : false,
			theme : "osx",
			showMaxButton : false, 
			iframeContent : true,
			//showMinButton : false,			
			raiseOnlyOnTitle:false,
			onClose : function() {iframeWinWeb[omet_id] = null;},
			urlContent : ourl
		});
		}
					
	}
	
	
	function papertree(otype,oid){
		//alert(otype+','+oid);
		if(otype=='plus'){
			document.getElementById(oid+'_p').style.display='block';
			document.getElementById(oid+'_m').style.display='none';
			document.getElementById(oid+'_table').style.display='none';
		}
		else{
			document.getElementById(oid+'_p').style.display='none';
			document.getElementById(oid+'_m').style.display='block';
			document.getElementById(oid+'_table').style.display='block';
		}
			
	}
	
	var startDate;
	var endDate;
	var calMy2;
	var calMy3;
	function subCalendar2(oinput,obutton,ostartDate, oendDate){
		//startDate = new Date(cal.date)
		//startDate.setHours(0,0,0,0)
			//alert(ostartDate+', '+oendDate);
		calMy3 = new Zapatec.Calendar.setup({
		
			inputField:oinput,
			ifFormat:"%Y-%m-%d",
			button:obutton,
			//dateStatusFunc:disallowDateBefore,
			showsTime:false,
			range : [ostartDate, oendDate],
			noHelp : true

		});
		
	}
	
	
	
	function subCalendar(oinput,obutton,ostartDate, oendDate){
		//startDate = new Date(cal.date)
		//startDate.setHours(0,0,0,0)
			//alert(ostartDate+', '+oendDate);
		calMy2 = new Zapatec.Calendar.setup({
		
			inputField:oinput,
			ifFormat:"%Y-%m-%d",
			button:obutton,
			dateStatusFunc:disallowDateBefore,
			showsTime:false,
			range          : [ostartDate, oendDate],
			noHelp		  :         true

		});
		
	}
	
	function disallowDateBefore(dateCheckOut) {
			//if(dateCheckOut.getDay() == 6 || dateCheckOut.getDay() == 0 || dateCheckOut.getDay() == 1 || dateCheckOut.getDay() == 2 || dateCheckOut.getDay() == 3 || dateCheckOut.getDay() == 5)
				//return true;
			var nowformat=new Date();
			var endformat=new Date();
			var checkformat=new Date();
			nowformat.setYear(startDate.split('-')[0]);
			nowformat.setMonth(startDate.split('-')[1]);
			nowformat.setDate(startDate.split('-')[2]);
			
			endformat.setYear(endDate.split('-')[0]);
			endformat.setMonth(endDate.split('-')[1]);
			endformat.setDate(endDate.split('-')[2]);
			
			checkformat.setYear(dateCheckOut.getFullYear());
			checkformat.setMonth(dateCheckOut.getMonth()+1);	
			checkformat.setDate(dateCheckOut.getDate());
			
			
			if(checkformat.setHours(0,0,0,0)<nowformat.setHours(0,0,0,0))
				return true;
			
			if(checkformat.setHours(0,0,0,0)>endformat.setHours(0,0,0,0))
				return true;

			return false;
		}
		
	var oldsel=0;
	
	function reqLenFunc(otype,oele,oid){
		
		var jsTRid;
		jsTRid='vlenTR'+oldsel;
		if(otype=='over' && oele.id!=jsTRid){
				oele.bgColor='#BDD6F7';
		}
		
		if(otype=='out' && oele.id!=jsTRid){
				oele.bgColor='#D4E7FD';
		}
		
		if(otype=='click' && oele.id!=jsTRid){
			var jsCHECKid;
			jsCHECKid='vlensel'+oldsel;
				if(oldsel!=0){
					document.getElementById(jsTRid).bgColor='#D4E7FD';
					document.getElementById(jsCHECKid).checked='';
				}
			var jsCHECKid2;
			jsCHECKid2='vlensel'+oid;
				oldsel=oid;
				oele.bgColor='#6390C8';
				document.getElementById(jsCHECKid2).checked='checked';
		}
		
	}
	
	
	
		var startDate2;
		var endDate2;

		function resetDates() {
			startDate2 = endDate2 = null;
		}

		function filterDates12(cal) {
			startDate2 = new Date(cal.date)
			startDate2.setHours(0,0,0,0)	// used for compares without TIME
			/* If they haven't chosen an 
			end date before we'll set it to the same date as the start date This
			way if the user scrolls in the start date 5 months forward, they don't
			need to do it again for the end date.
			*/

			if (endDate2 == null) { 
				Zapatec.Calendar.setup({
					inputField     :    checkoutSave,
					button         :    checkoutBSave,  // What will trigger the popup of the calendar
					ifFormat		:	"%Y-%m-%d",
					date           :     cal.date,
					showsTime      :     false,          //no time
					dateStatusFunc		:    disallowDateBefore2, //the function to call
					onUpdate       :    filterDates2
				});
			}
		}

		function filterDates2(cal) {
			var date = cal.date;
			endDate2 = new Date(cal.date)
			endDate2.setHours(0,0,0,0)	// used for compares without TIME
		}

		/*
		* This functions return true to disallow a date
		* and false to allow it.
		*/


		/* 
		* Check-Out calendar allowed dates
		* Check-Out date can not be BEFORE Check-In date
		* Check-Out date can not be before today
		*/
		function disallowDateBefore2(dateCheckOut) {
			//if(dateCheckOut.getDay() == 6 || dateCheckOut.getDay() == 0 || dateCheckOut.getDay() == 1 || dateCheckOut.getDay() == 2 || dateCheckOut.getDay() == 3 || dateCheckOut.getDay() == 5)
				//return true;
				
			dateCheckOut.setHours(0,0,0,0)
			if ((startDate2 != null) && startDate2 > dateCheckOut)
				// startDate2 is defined, make sure cal date is NOT before start date
				return true; 
			
			var nowformat=new Date();
			var checkformat=new Date();
			nowformat.setYear(startDate.split('-')[0]);
			nowformat.setMonth(startDate.split('-')[1]);
			nowformat.setDate(startDate.split('-')[2]);						
			
			checkformat.setYear(dateCheckOut.getFullYear());
			checkformat.setMonth(dateCheckOut.getMonth()+1);	
			checkformat.setDate(dateCheckOut.getDate());
			
			//var now = new Date()
			//now.setHours(0,0,0,0)
			//if (dateCheckOut < now) 			
			if(checkformat.setHours(0,0,0,0)<nowformat.setHours(0,0,0,0))
				return true;


			return false;
		}

		/* 
		* Check-In date checking
		* Check-In date can not be AFTER Check-Out date
		* Check-In date can not be before today
		*/
		function disallowDateAfter2(dateCheckIn) {
			//if(dateCheckIn.getDay() == 6 || dateCheckIn.getDay() == 0 || dateCheckIn.getDay() == 1 || dateCheckIn.getDay() == 2 || dateCheckIn.getDay() == 3 || dateCheckIn.getDay() == 5)
				//return true;
				
			dateCheckIn.setHours(0,0,0,0)
			if ((endDate2 != null) && dateCheckIn > endDate2)
				// endDate2 defined, calendar date can NOT be after endDate2
				return true;

			var nowformat=new Date();
			var checkformat=new Date();
			nowformat.setYear(startDate.split('-')[0]);
			nowformat.setMonth(startDate.split('-')[1]);
			nowformat.setDate(startDate.split('-')[2]);						
			
			checkformat.setYear(dateCheckIn.getFullYear());
			checkformat.setMonth(dateCheckIn.getMonth()+1);	
			checkformat.setDate(dateCheckIn.getDate());
			
			if(checkformat.setHours(0,0,0,0)<nowformat.setHours(0,0,0,0))
				return true;
				
				
			return false;
		}
	
	var calMy5;
	var calMy6;
	var checkoutSave='';
	var checkoutBSave='';
	function checkdatestart(oinput1,obutton1,oinput2,obutton2){
		checkoutSave=oinput2;
		checkoutBSave=obutton2;
		calMy5 = new Zapatec.Calendar.setup({
		
         inputField     :    oinput1,   // id of the input field
         button         :    obutton1,  // What will trigger the popup of the calendar
         ifFormat		:	"%Y-%m-%d",       // format of the input field: Mar 18, 2005
         showsTime      :     false,          //no time
         dateStatusFunc    :    disallowDateAfter2, //the function to call
         onUpdate       :    filterDates12

		});
		
      calMy6=Zapatec.Calendar.setup({
         inputField     :    oinput2,
         button         :    obutton2,  // What will trigger the popup of the calendar
        ifFormat		:	"%Y-%m-%d",        // format of the input field: Mar 18, 2005
         showsTime      :     false,          //no time
         dateStatusFunc    :    disallowDateBefore2, //the function to call
         onUpdate       :    filterDates2
      });
	}
	
	function adcheckFunc(onumber){
		var res=document.getElementById('vadval').value;
		var tot=document.getElementById('vadtot').value;
		
		//alert(res+'***'+tot);
		if(document.getElementById('vadsel'+onumber).checked){
			tot=tot*1+document.getElementById('vadselH'+onumber).value*1;
			res=res+document.getElementById('vadsel'+onumber).value+',';
		}else{
			tot=tot*1-document.getElementById('vadselH'+onumber).value*1;
			res=res.replace(document.getElementById('vadsel'+onumber).value+',','');
		}
			
		document.getElementById('vadval').value=res;
		document.getElementById('vadtot').value=tot;
		document.getElementById('priceTD').innerHTML='$'+tot;
	}
	
	function fullScreenWin(theURL) {
		window.open(theURL, '', 'fullscreen=yes,scrollbars=No,toolbar=No,location=No,directories=No,menubar=No,status=No,titlebar=No,resizable=yes');
	}
