﻿function jumpfields(fieldName, nextFieldName)
{
    var form = document.forms[0];
    if ((form.elements[fieldName] != null) && (form.elements[fieldName]))
    {
        var field = form.elements[fieldName];
        field.nextField = form.elements[nextFieldName];
        
        field.onkeydown = jumpfields_keyDown;
        field.onkeyup = jumpfields_keyUp;
    }
}

function jumpfields_keyDown()
{
    this.beforeLength = this.value.length;
    dsf = this;
}

function jumpfields_keyUp()
{
    if ((this == dsf) && (this.value.length > this.beforeLength) && (this.value.length >= this.maxLength))
        this.nextField.focus();
    
    dsf = null;
}

var sound = null;
        
function play_sound(obj, sound_path) {
    
    if (sound) {
    
        try { sound.childNodes[0].className = 'play'; } catch (e) { }
        try { sound.className = 'play'; } catch (e) { }
    }
    
    if (sound == obj) {
    
        try { obj.className = 'play'; } catch (e) { }
        try { obj.childNodes[0].className = 'play'; } catch (e) { }
        
        sound = null;
        
        document.getElementById('player').innerHTML = '';
    
    } else {
       
        try { obj.childNodes[0].className = 'play stop'; } catch (e) { }
        try { obj.className = 'play stop'; } catch (e) { }

        sound = obj;
        
        if (!document.getElementById('player')) {
        
            var div = document.createElement('div');
            div.id = 'player';
            obj.appendChild(div);
        }
        
        var so = new SWFObject('/Flash/Player.swf', 'playsample', '0', '0', '8');
        so.addVariable('sound_path', sound_path);
        so.write('player');
    }
}

/* Retira a borda dos flashes
Copyright 2006 Adobe Systems, Inc. All rights reserved.
Versão compacta, alterada por André Assis
	- src, width e height são obrigatórios
	- os demais parametros são opcionais
*/

function flash(src, width, height, id, flashVars, wmode, menu, scale){
	var ret = GetArguments(src, width, height, id, flashVars, wmode, menu, scale);
	var str = '<object ';
	for (var i in ret.objAttrs)
		str += i + '="' + ret.objAttrs[i] + '" ';
	str += '>';
	for (var i in ret.params)
		str += '<param name="' + i + '" value="' + ret.params[i] + '" /> ';
	str += '</object>';
	document.write(str);
}

//GetArguments(): função auxiliar para retirar a borda dos flashes
//	- retorna os argumentos da tag object e os parametros
function GetArguments(src, w, h, id, flashVars, wmode, menu, scale){
	var ret = new Object();
	ret.params = new Object();
	ret.objAttrs = new Object();

	ret.objAttrs['data'] = ret.params['movie'] = src;
	ret.objAttrs['width'] = w;
	ret.objAttrs['height'] = h;
	ret.params['quality'] = 'high';
	ret.objAttrs['type'] = 'application/x-shockwave-flash';
	ret.params['menu'] = 'false';
	
	if(id) ret.objAttrs['id'] = id;

	if(flashVars) ret.params['flashVars'] = flashVars;
	
	ret.params['wmode'] = (wmode)? wmode : 'transparent';
	ret.params['menu'] = (menu)? menu : 'false';
	ret.params['scale'] = (scale)? scale : 'exactfit';
	
	return ret;
}

function popupcdweb(){

    window.open('Hanzo/cdweb.html', 'popupsaibamais', 'width=600, height=400, location=0, directories=0, status=0, menubar=0, scrollbars=0, top=300px, left=300px, menubar=0, resizable=0');
}

