// Arguments : flashMovie(Ãâ·Â¿µ¿ªID,ÇÃ·¹½¬ÆÄÀÏ°æ·Î,WIDTH,HEIGHT[,FLASHVARS[,WMOD]]) 

function flashMovie(fid,src,wid,hei,fvs,wmd) { 
  this.fPrint = ''; 
  this.Id = document.getElementById(fid); 
  this.Src = src; 
  this.Width = wid; 
  this.Height = hei; 
  this.FlashVars = (fvs != undefined)? fvs :''; 
  this.Wmod = (wmd != undefined)? wmd :''; 
  if(isObject(Id)) { 
    fPrint = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"'; 
    fPrint += ' width="'+Width+'"'; 
    fPrint += ' height="'+Height+'">'; 
    fPrint += '<param name="movie" value="'+Src+'">'; 
    fPrint += '<param name="quality" value="high">'; 
    fPrint += (FlashVars != null) ? '<param name="FlashVars" value="'+FlashVars+'">' : ''; 
    fPrint += (Wmod != null) ? '<param name="wmode" value="'+Wmod+'">' : ''; 
    fPrint += '<embed'; 
    fPrint += fPrint + ' src="'+Src+'"'; 
    fPrint += (FlashVars != null) ? ' FlashVars="'+FlashVars+'"' : ''; 
    fPrint += (Wmod != null) ? ' wmode="'+Wmod+'"' : ''; 
    fPrint += ' quality="high"'; 
    fPrint += ' pluginspage="http://www.macromedia.com/go/getflashplayer"'; 
    fPrint += ' type="application/x-shockwave-flash"'; 
    fPrint += ' width="'+Width+'"'; 
    fPrint += ' height="'+Height+'"'; 
    fPrint += '></embed>'; 
    fPrint += '</object>'; 
    Id.innerHTML = fPrint; 
  } 
} 

function isObject(a) { 
    return (a && typeof a == 'object'); 
}

function count_demo(){
	new Ajax.Request('/product/count_download_demo.php',{
		onSuccess: function(result){
		},
		onFailure: function(result){
			alert(result.responseText);
		}
	});
}

function download(){
	document.location='http://checkout.cyberfence.com/download/CyberFenceSetup.exe';
}

function help_flash(swf){
	$('board_body').hide();
	$('flash_btn').hide();
	$('board_btn').show();
	$('flash_body').remove();
	new Insertion.After('before_flash',"<td id='flash_body' rowspan='8'><div id='flash' style='height:444px; float:left'><script type='text/javascript' language='javascript'>flashMovie('flash','"+swf+"',750,444,'','transparent');</script></div></td>");
}

function toggle_visible(mode){
	if(mode=='flash'){
		$('flash_body').toggle();
		$('flash_btn').toggle();
		$('board_btn').toggle();
		$('board_body').toggle();
	}
	else if(mode=='board'){
		if(getParameter(mode)!='true'){
			$('search').submit();
		}
		$('board_body').toggle();
		$('board_btn').toggle();
		$('flash_btn').toggle();
		$('flash_body').toggle();
	}		
}


function getParameter(name) {
   var url = window.location.href;
   var paramsStart = url.indexOf("?");

   if(paramsStart != -1){

      var paramString = url.substr(paramsStart + 1);
      var tokenStart = paramString.indexOf(name);

      if(tokenStart != -1){

         paramToEnd = paramString.substr(tokenStart + name.length + 1);
         var delimiterPos = paramToEnd.indexOf("&");

         if(delimiterPos == -1){
            return paramToEnd;
         }
         else {
            return paramToEnd.substr(0, delimiterPos);
         }
      }
   }
}
