function setPng24(obj) {
 obj.width=obj.height=1;
 obj.className=obj.className.replace(/\bpng24\b/i,'');
 obj.style.filter =
 "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
 obj.src=''; 
 return '';
}
//png

function initMoving01(target, position, topLimit, btmLimit) {
 if (!target)
  return false;
 var obj = target;
 obj.initTop = position;
 obj.topLimit = topLimit;
 obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;
 obj.style.position = "absolute";
 obj.top = obj.initTop;
 obj.left = obj.initLeft;
 if (typeof(window.pageYOffset) == "number") {
  obj.getTop = function() {
   return window.pageYOffset;
  }
 } else if (typeof(document.documentElement.scrollTop) == "number") {
  obj.getTop = function() {
   return document.documentElement.scrollTop;
  }
 } else {
  obj.getTop = function() {
   return 0;
  }
 }
 if (self.innerHeight) {
  obj.getHeight = function() {
   return self.innerHeight;
  }
 } else if(document.documentElement.clientHeight) {
  obj.getHeight = function() {
   return document.documentElement.clientHeight;
  }
 } else {
  obj.getHeight = function() {
   return 500;
  }
 }
 obj.move = setInterval(function() {
  if (obj.initTop > 0) {
   pos = obj.getTop() + obj.initTop;
  } else {
   pos = obj.getTop() + obj.getHeight() + obj.initTop;
   //pos = obj.getTop() + obj.getHeight() / 2 - 15;
  }
  if (pos > obj.bottomLimit)
   pos = obj.bottomLimit;
  if (pos < obj.topLimit)
   pos = obj.topLimit;
  interval = obj.top - pos;
  obj.top = obj.top - interval / 3;
  obj.style.top = obj.top + "px";
 }, 30)
}

function PnFlash(fname,wlen,hlen)
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ');
document.write('width="');
document.write(wlen);
document.write('" height="');
document.write(hlen);
document.write('" >');
document.write('<param name="movie" value="');
document.write(fname);
document.write('">');
document.write('<param name="quality" value="high"> ');
document.write('<param name=wmode value=transparent> ');
document.write('<embed src="');
document.write(fname);
document.write('"');
document.write('width="');
document.write(wlen);
document.write('" height="');
document.write(hlen);
document.write('"');
document.write(' align="right" quality="high" ');
document.write('wmode=transparent pluginspage="http://www.macromedia.com/go/getflashplayer" ');
document.write('scale="noscale" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash"></embed></object>');
}

/* fileUpload */
(function($) {
    
    $.fn.filestyle = function(options) {
                
        /* TODO: This should not override CSS. */
        var settings = {
            width : 250
        };
                
        if(options) {
            $.extend(settings, options);
        };
                        
        return this.each(function() {
            
            var self = this;
            var wrapper = $("<div>")
                            .css({
                                "width": settings.imagewidth + "px",
                                "height": settings.imageheight + "px",
                                "background": "url(" + settings.image + ") 0 0 no-repeat",
                                "background-position": "right",
								"marginLeft":"5px",
                                "display": "inline",
                                "position": "absolute",
                                "overflow": "hidden"
                            });
                            
            var filename = $('<input class="file">')
                             .addClass($(self).attr("class"))
                             .css({
                                 "display": "inline",
                                 "width": settings.width + "px"
                             });

            $(self).before(filename);
            $(self).wrap(wrapper);

            $(self).css({
                        "position": "relative",
                        "height": settings.imageheight + "px",
                        "width": settings.width + "px",
                        "display": "inline",
                        "cursor": "pointer",
                        "opacity": "0.0"
                    });

            if ($.browser.mozilla) {
                if (/Win/.test(navigator.platform)) {
                    $(self).css("margin-left", "-142px");                    
                } else {
                    $(self).css("margin-left", "-168px");                    
                };
            } else {
                $(self).css("margin-left", settings.imagewidth - settings.width + "px");                
            };

            $(self).bind("change", function() {
                filename.val($(self).val());
            });
      
        });
        

    };
    
})(jQuery);

/* faq */
function initToggle(tabContainer) {
	triggers = tabContainer.getElementsByTagName("a");

	for(i = 0; i < triggers.length; i++) {
		if (triggers.item(i).href.split("#")[1])
			triggers.item(i).targetEl = document.getElementById(triggers.item(i).href.split("#")[1]);

		if (!triggers.item(i).targetEl)
			continue;

		triggers.item(i).targetEl.style.display = "none";
		triggers.item(i).onclick = function () {
			if (tabContainer.current == this) {
				this.targetEl.style.display = "none";
				tabContainer.current = null;
			} else {
				if (tabContainer.current) {
					tabContainer.current.targetEl.style.display = "none";
					tabContainer.current.className="";
				}
				this.targetEl.style.display = "block";
				tabContainer.current = this;
			}
			return false;
		}
	}
}

