var winHandler;

function  SubmitForm(actionPage,Month,tab) {
document.frmListAds.MTP.value='';
document.frmListAds.tab.value=tab;
document.frmListAds.mth.value=Month;
document.frmListAds.action=actionPage;
document.frmListAds.submit();
}
function  SubmitFormArchive(actionPage,tab) {
document.frmListAds.MTP.value='';
document.frmListAds.tab.value=tab;
document.frmListAds.mth.value='8';
document.frmListAds.year.value='2003';
document.frmListAds.submit();
}



function SubmitFormbyAddMth(actionPage,Month, Year) {
if (Month < 12 )
   {Month++;} 
else
   {Month=1;Year++;}
document.frmListAds.MTP.value='';
document.frmListAds.tab.value='1';
document.frmListAds.mth.value=Month;
document.frmListAds.year.value = Year;
document.frmListAds.action=actionPage;
document.frmListAds.submit();

}

function SubmitFormbySubtractMth(actionPage,Month, Year) {
if (Month > 1 )
   {Month--;} 
else
   {Month=12;Year--;}
document.frmListAds.MTP.value='';
document.frmListAds.tab.value='1';
document.frmListAds.mth.value=Month;
document.frmListAds.year.value = Year;
document.frmListAds.action=actionPage;
document.frmListAds.submit();
}

function submitWin(mth,yr)
{
if (form == null)
	window.close();	

	yr = validYear(yr);
	SubmitCalendar(form,mth,yr);

}

function SubmitCalendar(frm,mth,yr) 
{

var option = Number(frm.option.value);	

	if (frm)
	{
		
	if (option == 2)
	{
		frm.action = "/advertisement/listAdvertisement.asp";
		frm.year.value = yr;
		frm.mth.value = mth;
		frm.tab.value = "1";
		if (frm.by)
		frm.by.value = '';
	}
	else if (option == 3)
	{

		frm.tab.value = "2";
		frm.year.value = yr;
		frm.mth.value = mth;
			

	}
	else
	{
		frm.tab.value = "1";
		frm.year.value = yr;
		frm.mth.value = mth;
		
	}
	

	frm.submit();
	}
window.close();
}

		


function opCal()
{

    var e;
    var optional="";
	if(navigator.appName != "Netscape")
	{
    	if(!e) e = event;
    	x = e.clientX||0;
    	y = e.clientY||0;
    	x+=window.screenLeft
    	y+=window.screenTop
	optional=",top=" + y + ",left=" + x
	}

if (!winHandler || winHandler.closed)
	{
	winHandler =window.open("/advertisement/_include/calendar.htm","","location=0,status=0,scrollbars=0,width=200,height=130" + optional);	
	}
	else {winHandler.focus()};
}	




function validYear(yr)
{
var now = new Date();

if (isNaN(yr) == true || yr.toString().length != 4 || Number(yr) <= 0 || yr.toString().indexOf(".") != -1)
	return now.getFullYear();
else
	return yr;
}














