<!--hide script from old browsers 
//////////////////////////////////////////////////////////////////////
//								    //	
// This file holds javascript functions that are used throughout    //
// hermesbooks.com website for navigation and popups.          	    //
//								    //	
// BG Version. 							    //		
//								    //	
// Copyright (c) 2002, 2003 VeDa Group, Ltd.			    //
//								    //
// Author: Vess Kavrakov, vkavrakov@vedagroup.com		    //
//								    //
//////////////////////////////////////////////////////////////////////
// array function

        function makeArray(len)
        {       for (var i = 0; i < len; i++)
                {       this[i] = null
                }
                this.length = len
        }


// array of day names

        var daynames = new makeArray(7)
        daynames[0] = "Неделя"
        daynames[1] = "Понеделник"
        daynames[2] = "Вторник"
        daynames[3] = "Сряда"
        daynames[4] = "Четвъртък"
        daynames[5] = "Петък"
        daynames[6] = "Събота"


// array of month names

        var monthnames = new makeArray(12)
        monthnames[0] = "Януари"
        monthnames[1] = "Февруари"
        monthnames[2] = "Март"
        monthnames[3] = "Април"
        monthnames[4] = "Май"
        monthnames[5] = "Юни"
        monthnames[6] = "Юли"
        monthnames[7] = "Август"
        monthnames[8] = "Септември"
        monthnames[9] = "Октомври"
        monthnames[10] = "Ноември"
        monthnames[11] = "Декември"


// define date variables

        var now = new Date()
        var day = now.getDay()
        var month = now.getMonth()
        var year = now.getYear()
        var date = now.getDate()
        var hour=now.getHours()
        var minutes=now.getMinutes()


// check for the year and browser used

if ((navigator.appName == "Microsoft Internet Explorer") && (year < 2000))
    {
       year = "19" + year
    }
if (navigator.appName == "Netscape")
    {
       year = 1900 + year
    }



// write date

        function writeDate()
        {       document.write (daynames[day]+", " + date + " " + monthnames[month] + ", " + year)
        }
        
function changeto(highlightcolor){
	source=event.srcElement
	if (source.tagName=="TR"||source.tagName=="TABLE")
	return
	while(source.tagName!="TD")
	source=source.parentElement
	if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
	source.style.backgroundColor=highlightcolor
}
function changeback(originalcolor){
	if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
	return
	if (event.toElement!=source)
	source.style.backgroundColor=originalcolor
}

// code for pop-ups ...

var popWin = null;

function openPop(popUp)
{

     if (popWin && !popWin.closed) {

	popWin.close();

     }

     popWin = window.open(popUp, "popWin", "width=420,height=460,scrollbars=0,toolbars=0,resizable=0")

     popWin.focus()

}       

var infoWin = null;

function loadInfo(){

     if (infoWin && !infoWin.closed) {

	infoWin.close();

     }

     infoWin = window.open("shipinfo.php", "infoWin", "width=520,height=400,scrollbars=2,toolbars=0,resizable=0")

     infoWin.focus()

}

function checkRequiredPay() {

	//check if required fields have been filled
	errMsg = "Моля попълнете всички задължителни полета!\n\n";
	err = 0;
	pos=0;

	firstname = document.form.clientFirst;
	familyname = document.form.clientLast;
	email= document.form.clientEmail;
	address = document.form.clientAddress;
	city = document.form.clientCity;
	zip= document.form.clientZIP;
	tel = document.form.clientTel1;
	

	if (!firstname.value)
	{
		errMsg = errMsg + "   - Първо име \n";
		err = 1;
		pos = 0;

	}
	if (!familyname.value)
	{
		errMsg = errMsg + "   - Фамилия\n";
		err = 1;
		if (pos == 0) pos = 2;

	}
	if (!email.value)
	{
		errMsg = errMsg + "   - E-mail\n";
		err = 1;
		if (pos == 0) pos = 4;

	}
	if (!address.value)
	{
		errMsg = errMsg + "   - Адрес\n";
		err = 1;
		if (pos == 0) pos = 5;

	}
	if (!city.value)
	{
		errMsg = errMsg + "   - Град\n";
		err = 1;
		if (pos == 0) pos = 6;

	}
	if (!zip.value)
	{
		errMsg = errMsg + "   - Пощенски код\n";
		err = 1;
		if (pos == 0) pos = 7;

	}
	if (!tel.value)
	{
		errMsg = errMsg + "   - Телефон\n";
		err = 1;
		if (pos == 0) pos = 9;

	}
	
	
	//check if invoice selected
	
	if (document.form.oInvoice.options[1].selected) { 
		
		//check mandatory fields for invoice

		if (!document.form.oInvName.value)
		{
			errMsg = errMsg + "   - Фактура (Получател)\n";
			err = 1;
			if (pos == 0) pos = 12;
		
		}

		if (!document.form.oInvCity.value)
		{
			errMsg = errMsg + "   - Фактура (Град)\n";
			err = 1;
			if (pos == 0) pos = 13;
		
		}
		if (!document.form.oInvAddress.value)
		{
			errMsg = errMsg + "   - Фактура (Адрес)\n";
			err = 1;
			if (pos == 0) pos = 14;
		
		}
		if (!document.form.oInvMOL.value)
		{
			errMsg = errMsg + "   - Фактура (МОЛ)\n";
			err = 1;
			if (pos == 0) pos = 15;
		
		}
		if (!document.form.oInvBulstat.value)
		{
			errMsg = errMsg + "   - Фактура (Булстат)\n";
			err = 1;
			if (pos == 0) pos = 16;
		
		}
		if (!document.form.oInvDNo.value)
		{
			errMsg = errMsg + "   - Фактура (Дан. Номер)\n";
			err = 1;
			if (pos == 0) pos = 17;
		
		}
		if (!document.form.oInvEGN.value)
		{
			errMsg = errMsg + "   - Фактура (ЕГН)\n";
			err = 1;
			if (pos == 0) pos = 18;
		
		}
	
	
	} 
	
	
	
	//radio button check
	shipcountry = -1;
	for (i=document.form.shipCountry.length-1; i > -1; i--) {
		if (document.form.shipCountry[i].checked) {
			shipcountry = i;
		}
	}
		
	if (shipcountry < 0)
	{
		errMsg = errMsg + "   - Начин на доставка\n";
		err = 1;
		if (pos == 0) pos = 19;

	}
	else { 
	
		if (shipcountry == 0) { 
			if (document.form.shipBG.options[0].selected) { 
				errMsg = errMsg + "   - Населено място за доставка\n";
				err = 1;
				if (pos == 0) pos = 21;

			} 
		}
	} 

	if (err==1) {
		alert(errMsg);
		document.form.elements[pos].focus();
		return false;

	}

	return true;

}





function checkRequiredPay2() {

	//check if required fields have been filled
	errMsg = "Моля попълнете всички задължителни полета!\n\n";
	err = 0;
	pos=0;	
		
	//radio button check
	
	if (typeof(document.form.shipChoice)!="undefined") { 
		shipchoice = -1;
		for (i=document.form.shipChoice.length-1; i > -1; i--) {
			if (document.form.shipChoice[i].checked) {
				shipchoice = i;
			}
		}

		if (shipchoice < 0)
		{
			errMsg = errMsg + "   - Начин на доставка\n";
			err = 1;

		}
	}
	
	//radio button check
	paychoice = -1;
	for (i=document.form.payChoice.length-1; i > -1; i--) {
		if (document.form.payChoice[i].checked) {
			paychoice = i;
		}
	}
		
	if (paychoice < 0)
	{
		errMsg = errMsg + "   - Начин на плащане\n";
		err = 1;

	}
	

	if (err==1) {
		alert(errMsg);
		return false;

	}

	return true;

}

////////////////////////////////////////////////////////////
//							  //
// 			END OF SCRIPT			  //
//							  //
////////////////////////////////////////////////////////////
//-->