opera = (window.opera) ? true : false;
ie = (document.all && !opera) ? true : false;

var version = 6;
var flash = false;
if (navigator.plugins) {
	if(navigator.plugins["Shockwave Flash"]) {
		plugin = navigator.plugins["Shockwave Flash"].description;
		flash = parseInt(plugin.charAt(plugin.indexOf('.') - 2) + plugin.charAt(plugin.indexOf('.') - 1)) >= version;
	} else {
		if ((navigator.userAgent.indexOf('MSIE') != -1)&&(navigator.userAgent.indexOf('Win') != -1)) {
		  	var vb = '<script language="vbscript">\n'
			+ ' on error resume next\n'
			+ ' flash = IsObject(CreateObject('
			+ ' "ShockwaveFlash.ShockwaveFlash.' + version + '"))\n'
			+ '<' + '/script>';
			document.write(vb);
		}
	}
}

function PrintFlash(path, wid, heg, pic, lnk, paramz, bg, wm, alt, top) {
	if(flash){
		document.open();
                if(top){
                    document.write ('<img src="' + top + '" width="' + wid + '" height="' + heg + '" alt="'+alt+'" style="position:absolute;">');
                }
		document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="6,0,0,0" width="' + wid + '" height="' + heg + '">');
		document.write ('<param name=movie value="' + path + '">');
		document.write ('<param name="quality" value="high">');
		if(wm && wm != '') document.write ('<param name="wmode" value="' + wm + '">');
		else{
			document.write ('<param name="wmode" value="transparent">');
			wm = 'transparent';
		}
		document.write ('<param name="menu" value="false">');
		if(bg && bg != '') document.write ('<param name="bgcolor" value="' + bg + '">');
		document.write ('<param name="FlashVars" value="' + paramz + '">');
		document.write ('<embed src="' + path + '" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="' + wm + '" width="' + wid + '" height="' + heg +'" FlashVars="' + paramz + '" menu="false"></embed>');
  		document.write ('</object>');
		document.close();
	} else {
		document.open();
		if(lnk != '') document.write ('<a href="'+ lnk +'">');
		document.write('<img src="'+ pic +'" width="'+ wid +'" height="'+ heg +'" alt="'+alt+'">')
		if(lnk != '') document.write ('</a>');
		document.close();
	}
}

function submenu(name){
    obj = document.getElementById(name);
    if (obj.style.display == '') obj.style.display = 'none';
    else obj.style.display = '';
}

//function frame_order_load(obj){
//    document.title += '/+';
//}

function submenucat(lnk,name){
	for (var key in cat_names){
		//cat_names[key]
    	obj = document.getElementById(key);
		if (key == name){
		    if (obj.style.display == ''){
		    	obj.style.display = 'none';
			    lnk.className = 'mt';
		    }else{
		    	obj.style.display = '';
			    lnk.className = 'mt_open';
		    }
	    	/*obj.style.display = '';
		    lnk.className = 'mt_open';*/
		}else{
    		obj.style.display = 'none';
	    	lnkl = document.getElementById(key+'_a');
		    /*if (lnkl) */lnkl.className = 'mt';
		}
	}
    
    /*obj = document.getElementById(name);
    if (obj.style.display == ''){
    	obj.style.display = 'none';
	    lnk.className = 'mt';
    }else{
    	obj.style.display = '';
	    lnk.className = 'mt_open';
    }
    return true;*/
}

function CheckPDAload(link){
    var height=0;
    var width=0;
    colorDepth = screen.colorDepth;

    if (self.screen){
      width = screen.width;
      height = screen.height;
    }else if (self.java){
      var jToolKit = java.awt.Toolkit.getDefaultToolkit();
      var scrsize = jToolKit.getScreenSize();
      width = scrsize.width;
      height = scrsize.height;
    }

    if (width > 0 && height > 0){
      window.location.href = link + "?screen_width=" + width + "&screen_height=" + height + "&screen_color=" + colorDepth;
    }else exit();
}

function ListShowMore(name, count){
    var last = 0;
    obj = $(name);
    $.each(obj, function(key, value){
        if(value.style.display == 'none' && count > 0){
            value.style.display = '';
            count--;
            last = key;
        }else if(count < 1) return(false);
    });
    if(last == (obj.length-2) || last == 0) obj[obj.length-1].style.display = 'none';
}

function InputTextBlur(obj, text){
    if(obj.value != ''){
        obj.onfocus = function(){};
    }else{
        obj.value = text;
        obj.onfocus = function(){obj.value='';};
    }
}

function FieldByType(obj, field){
    switch(obj.value){
        case 'datetime':
            document.getElementById('datetime_'+field).style.display = '';
            document.getElementById('text_'+field).style.display = 'none';
            document.getElementById('paragraph_'+field).style.display = 'none';
            document.getElementById('file_'+field).style.display = 'none';
            document.getElementById('bool_'+field).style.display = 'none';
            break;
        case 'int':
        case 'float':
        case 'text':
            document.getElementById('datetime_'+field).style.display = 'none';
            document.getElementById('text_'+field).style.display = '';
            document.getElementById('paragraph_'+field).style.display = 'none';
            document.getElementById('file_'+field).style.display = 'none';
            document.getElementById('bool_'+field).style.display = 'none';
            break;
        case 'paragraph':
            document.getElementById('datetime_'+field).style.display = 'none';
            document.getElementById('text_'+field).style.display = 'none';
            document.getElementById('paragraph_'+field).style.display = '';
            document.getElementById('file_'+field).style.display = 'none';
            document.getElementById('bool_'+field).style.display = 'none';
            break;
        case 'file':
            document.getElementById('datetime_'+field).style.display = 'none';
            document.getElementById('text_'+field).style.display = 'none';
            document.getElementById('paragraph_'+field).style.display = 'none';
            document.getElementById('file_'+field).style.display = '';
            document.getElementById('bool_'+field).style.display = 'none';
            break;
        case 'bool':
            document.getElementById('datetime_'+field).style.display = 'none';
            document.getElementById('text_'+field).style.display = 'none';
            document.getElementById('paragraph_'+field).style.display = 'none';
            document.getElementById('file_'+field).style.display = 'none';
            document.getElementById('bool_'+field).style.display = '';
            break;
        default:
            document.getElementById('datetime_'+field).style.display = 'none';
            document.getElementById('text_'+field).style.display = 'none';
            document.getElementById('paragraph_'+field).style.display = '';
            document.getElementById('file_'+field).style.display = 'none';
            document.getElementById('bool_'+field).style.display = 'none';
            break;
    }
}
