/*function openurl(){
	var url = document.selectNav.gotourl.options[document.selectNav.gotourl.selectedIndex].value;
    if ( url && url != '#' ) {
        eval("document.location='"+url+"'");
    }
}*/

/**
* Генерация флэш
*/

function generateFlash(movie, width, height, id, align)
		{
		  document.write('<object type="application/x-shockwave-flash" data="'+movie+'" width="'+width+'" height="'+height+'" id="'+id+'" align="'+align+'">');
		  document.write('<param name="movie" value="'+movie+'" />');
		  document.write('<param name="wmode" value="transparent" />');
		  document.write('<param name="autoStart" value="-1" />');
		  document.write('</object>');
		}


function tableBG()
{
        var rows = document.getElementsByTagName('tr');
        for(var i = 0; i < rows.length; i++)
        {

                if(i%2==0){
                        rows.item(i).className = "row1"
                }else{
                        rows.item(i).className = "row2"
                }

        }
}

document.write('<script type="text/javascript" src="/templates/js/shortcut.js"></script>');

function submitSearchForm()
{
    if (searchFormText.value != '') {
        searchForm.submit();
    }
}

function popupWindow(fileUrl, winW, winH, winN, scrollB) {
	var winWidth = winW;
	var winHeight = winH;
	var winName = (winN)? winN : 'popupWin'
	var scrollBars = (scrollB)? scrollB : 'auto'
	/*if (nn4 || ie4 || dom) {
		if (screen.width < winWidth + 50) { winWidth = screen.width - 50; scrollbars = 'yes' }
		if (screen.height < winHeight + 100) { winHeight = screen.height - 100; scrollbars = 'yes' }
		posX = Math.round((screen.width - winWidth) / 2);
		posY = Math.round((screen.height - winHeight) / 2);
		posCode = (nn4 || dom)? "screenX="+posX+",screenY="+posY : "left="+posX+",top="+posY;
	} else {*/
		posCode = "";
	//}
	var popupWin = window.open(fileUrl, winName,"menubar=no,toolbar=no,scrollbars=" + scrollBars + ",status=yes,resizable=yes,width=" + winWidth + ",height=" + winHeight + "," + posCode);
	if (popupWin) popupWin.focus();
}

/**
* Обработка поля ввода
*/

function inputController()
{

}

inputController.object = null;
inputController.button = null;
inputController.classActive = '';
inputController.classInactive = '';
inputController.defaultValue = '';
inputController.isSubmitable = '';

inputController.prototype.init = function(inputId, buttonId, defaultValue)
{
    // настройки
    this.classInactive = 'inputFieldInactive';
    this.classActive = 'inputFieldActive';
    this.defaultValue = defaultValue;
    this.isSubmitable = false;

    this.object = document.getElementById(inputId);
    this.button = document.getElementById(buttonId);

    this.object.className = this.classInactive;
    this.object.value = this.defaultValue;
}

inputController.prototype.clear = function()
{
    if ( this.object.value == this.defaultValue) {
        this.object.value = '';
    }
    this.object.className = this.classActive;
}

inputController.prototype.lostFocus = function()
{
    if (this.object.value == '' ||  this.object.value == this.defaultValue) {
        this.object.value = this.defaultValue;
        this.object.className = this.classInactive;
    }
}

inputController.prototype.keyPressed = function()
{
    if (this.object.value != '') {
        this.isSubmitable = true;
    } else {
        this.isSubmitable = false;
    }
}

inputController.prototype.submit = function()
{
    if (this.isSubmitable) {
        return true;
    }
    else return false;
}

function set_values()
{
	if (document.forms['feedback'].name.value == ""){
		document.forms['feedback'].name.value = "Ваше имя";
		document.forms['feedback'].name.className = 'com_in_inactive';
	}
	if (document.forms['feedback'].email.value == ""){
		document.forms['feedback'].email.value = "Ваш Email";
		document.forms['feedback'].email.className = 'com_in_inactive';
	}
	if(document.forms['feedback'].phone.value == "")
		document.forms['feedback'].phone.value = "Ваш телефон";
		document.forms['feedback'].phone.className = 'com_in_inactive';
	if (msg.value == ""){
		msg.value = "Текст сообщения";
		msg.className = 'com_in_inactive';
	}
	return;
}


function reset_value(name)
{
	switch (name) {
		case 'name':
			if (document.forms['feedback'].name.value == "Ваше имя")
				document.forms['feedback'].name.value = '';
			break;
		case 'email':
			if (document.forms['feedback'].email.value == "Ваш Email")
				document.forms['feedback'].email.value = '';
			break;
		case 'phone':
			if (document.forms['feedback'].phone.value == "Ваш телефон")
				document.forms['feedback'].phone.value = '';
			break;
		case 'message':
			if (msg.value == "Текст сообщения")
				msg.value = '';
			break;
	}
	return;
}
