// JavaScript Document
function collapseExpand(element,jmlhElement){
for(i=1;i<=jmlhElement;i++){	
document.getElementById(element + i).style.display =(document.getElementById(element+i).style.display=="none")?"":"none";
}	
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

function trim(item){
var tmp = "";
var item_length = item.value.length;
var item_length_minus_1 = item.value.length - 1;
for (index = 0; index < item_length; index++)
{
if (item.value.charAt(index) != ' ')
{
tmp += item.value.charAt(index);
}
else
{
if (tmp.length > 0)
{
if ((item.value.charAt(index+1) != ' ') && (index != item_length_minus_1))
{
tmp += item.value.charAt(index);
}
}
}
}
return (tmp) ;
}

function trim_image(item){
var tmp = "";
var item_length = item.length;
var item_length_minus_1 = item.length - 1;
for (index = 0; index < item_length; index++)
{
if (item.charAt(index) != ' ')
{
tmp += item.charAt(index);
}
else
{
if (tmp.length > 0)
{
if ((item.charAt(index+1) != ' ') && (index != item_length_minus_1))
{
tmp += item.charAt(index);
}
}
}
}
return (tmp) ;
}

function getExtension(obj){
var panjangString = obj.length;
obj = trim_image(obj);
for(i = 0 ; i < panjangString ; i++){
if(obj.charAt(i) == "."){
break;
}
}

extensi = obj.substring(i,panjangString).toLowerCase();
return extensi;
}

function toggle_display(o){
o.style.display=(o.style.display=='none')?'':'none';
}

function check_email(str){
var filter=/^.+@.+\..{2,3}$/;
if(filter.test(str)) return true;
else return false;
}

function is_allow_flash(){
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ){
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i){
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i]; 
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)){
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
return MM_FlashCanPlay;
}
