
userAgent = navigator.userAgent.toLowerCase();
isIE     = ((userAgent.indexOf("msie") != -1) && (userAgent.indexOf("opera") == -1));
isOpera  = (userAgent.indexOf("opera") != -1);
isMac     = (userAgent.indexOf("mac") != -1);
isMacIE = (isIE && isMac);
isWinIE = (isIE && !isMac);
isSafari = (userAgent.indexOf("safari") != -1);
isGecko  = (navigator.product == "Gecko" && !isSafari);
function menulist(id){
	var imgs = document.getElementById('menutxt').getElementsByTagName('img');
	for(var i=0;i<imgs.length;i++){
		imgs[i].src='/images/+.gif';	
	}
}
function tvshow(lor,n){
	var bt = document.getElementById('flashbt').getElementsByTagName('img');
	var nextkey;
	
	
	try{
		for(var key=0;key<bt.length;key++){
			if(bt[key].src.indexOf('/images/bt_on.gif')>0){
				bt[key].src='/images/bt_off.gif';
				
				if(lor==1){
					nextkey = key-1; if(nextkey<0)nextkey=bt.length-1;
					bt[nextkey].src='/images/bt_on.gif'; break;}
				else if(lor==2){
					
					nextkey = key	+1;
					if(nextkey>bt.length-1)nextkey=0;
					bt[nextkey].src='/images/bt_on.gif';break;}
			}
		}
		if(n || n===0){
			bt[n].src='/images/bt_on.gif';
			nextkey = n;
		}
		if(bt[nextkey].id)imgtoshow(bt[nextkey]);
	}catch(e){alert(e);}
	
}
var intval ;
function imgtoshow(obj){
	var element = document.getElementById('imgmove');
	var i=100;
	var y=0;
	element.style.opacity	=	1;
	element.style.filter	=	"Alpha(Opacity="+Math.abs(100)+")";
	clearInterval(intval);
	intval = setInterval(function(){
		i=i-5;
		if(i<y){
			if(y>100){
				clearInterval(intval);
			}else{
				y=y+5;i=i+5;
				element.style.opacity	=	Math.abs(y/100);
				element.style.filter	=	"Alpha(Opacity="+Math.abs(y)+")";
				if(element.src!=obj.id){
					element.src=obj.id;
					document.getElementById('flashtitle').innerHTML = obj.getAttribute('alt');
					//document.getElementById('flashdetail').innerHTML = obj.getAttribute('title'); 
				//	document.getElementById('txt_main').innerHTML = document.getElementById("t_"+obj.getAttribute('title')).innerHTML;
				}
			}
			  
		}else{
			element.style.opacity	=	Math.abs(i/100);
			element.style.filter	=	"Alpha(Opacity="+Math.abs(i)+")";}
		}
	,30);
	

}


function GetCurrentStyle (obj, prop) {     
    if (obj.currentStyle) {        
        return obj.currentStyle[prop];     
    }      
    else if (window.getComputedStyle) {        
        propprop = prop.replace (/([A-Z])/g, "-$1");           
        propprop = prop.toLowerCase ();        
        return document.defaultView.getComputedStyle (obj,null)[prop];     
    }      
    return null;   
}   
/**
 * Container Class (Prototype) for the dropDownMenu
 * 
 * @param idOrElement     String|HTMLElement  root Node of the menu (ul)
 * @param name            String              name of the variable that stores the result
 *                                            of this constructor function
 * @customConfigFunction  Function            optional config function to override the default settings
 *                                            for an example see Menu.prototype.config
 */
function Menu(idOrElement, name, customConfigFunction) {
  this.author = "Matthias Platzer AT knallgrau.at";
  this.copyright = "Copyright (c) 2004 Knallgrau New Medias Solutions GmbH, Vienna - Austria";
  this.license = "distributed under a BSD-Style license";

  this.lastUpdate = "2004-11-08";
  this.version = "0.4";

  this.name = name;
  this.type = "menu";
  this.closeDelayTimer = null;
  this.closingMenuItem = null; 

  this.config();
  if (typeof customConfigFunction == "function") {
    this.customConfig = customConfigFunction;
    this.customConfig();
  }

  this.rootContainer = new MenuContainer(idOrElement, this);
}

Menu.prototype.config = function() {
  this.collapseBorders = true;
  this.quickCollapse = true;
  this.closeDelayTime = 500;
};

function MenuContainer(idOrElement, parent) {
  this.type = "menuContainer";
  this.menuItems = [];
  this.init(idOrElement, parent);
}

MenuContainer.prototype.init = function(idOrElement, parent) {

  this.element = (typeof idOrElement == "string") ? document.getElementById(idOrElement) : idOrElement;
  this.parent = parent;
  this.parentMenu = (this.type == "menuContainer") ? ((parent) ? parent.parent : null) : parent;
  this.root = parent instanceof Menu ? parent : parent.root;
  this.id = this.element.id;

  if (this.type == "menuContainer") {
    if (this.hasClass("dropdown")) this.menuType = "dropdown";
    else if (this.hasClass("flyout")) this.menuType = "flyout";
    else if (this.hasClass("horizontal")) this.menuType = "horizontal";
    else this.menuType = "standard";
    if (this.menuType == "flyout" || this.menuType == "dropdown") {
      this.isOpen = false;
      this.element.style.position = "absolute";
      this.element.style.top = "0px";
      this.element.style.left = "0px"; 
      this.element.style.visibility = "hidden";
    } else {
      this.isOpen = true;
    }
  } else {
    this.isOpen = this.parentMenu.isOpen;
  }

  var childNodes = this.element.childNodes;
  if (childNodes == null) return;
  
  for (var i = 0; i < childNodes.length; i++) {
    var node = childNodes[i];
    if (node.nodeType == 1) {
      if (this.type == "menuContainer") {
        if (node.tagName.toLowerCase() == "li") {
          this.menuItems.push(new MenuItem(node, this));
        }
        
      } else {
        if (node.tagName.toLowerCase() == "ul") {
          this.subMenu = new MenuContainer(node, this);
        }
      }
    }
  }
};

MenuContainer.prototype.getAbsOffsetTop = function() {
  var offset = 0;
  var ele = this.element;
  var sl = (window.pageYOffset ? window.pageYOffset : document.body.scrollTop);
  do { offset += ele.offsetTop; ele = ele.offsetParent; } while (ele!=null && ele.style.position !="relative" && ele.style.position!="absolute" && (ele.style.position!="fixed"))
  return offset;
};

MenuContainer.prototype.getAbsOffsetLeft = function() {
  var offset = 0; 
  var ele = this.element;
  var sl = (window.pageXOffset ? window.pageXOffset : document.body.scrollLeft);
  do { offset += ele.offsetLeft; if (ele.style.position=='fixed') { offset+=sl }; ele = ele.offsetParent; } while (ele!=null)
  return offset;
};

MenuContainer.prototype.hasClass = function(className) {
  return (" " + this.element.className + " ").indexOf(className) > -1;
};

MenuContainer.prototype.getBorders = function(element) {
  var ltrb = ["Left","Top","Right","Bottom"];
  var result = {};
  for (var i in ltrb) {
    if (this.element.currentStyle)
      var value = parseInt(this.element.currentStyle["border"+ltrb[i]+"Width"]);
    else if (window.getComputedStyle)
      var value = parseInt(window.getComputedStyle(this.element, "").getPropertyValue("border-"+ltrb[i].toLowerCase()+"-width"));
    else
      var value = parseInt(this.element.style["border"+ltrb[i]]);
    result[ltrb[i].toLowerCase()] = isNaN(value) ? 0 : value;
  }
  return result;
};

MenuContainer.prototype.open = function() {
  if (this.root.closeDelayTimer) window.clearTimeout(this.root.closeDelayTimer);
  this.parentMenu.closeAll(this);
  this.element.style.visibility = "visible";
  this.isOpen = true;
  if (this.menuType == "dropdown") {
    this.element.style.top = 30 + "px";
    this.element.style.left = (this.parent.element.offsetLeft) + "px";
  } else if (this.menuType == "flyout") {
    var parentMenuBorders = this.parentMenu ? this.parentMenu.getBorders() : new Object();
    var thisBorders = this.getBorders();
    if (
      (this.parentMenu.getAbsOffsetLeft() + this.parentMenu.element.offsetWidth + this.element.offsetWidth + 20) > 
      (window.innerWidth ? window.innerWidth : document.body.offsetWidth)
    ) {
      this.element.style.left = (- this.element.offsetWidth - (this.root.collapseBorders ?  0 : parentMenuBorders["left"])) + "px";
    } else {
      this.element.style.left = (this.parentMenu.element.offsetWidth - parentMenuBorders["left"] - (this.root.collapseBorders ?  Math.min(parentMenuBorders["right"], thisBorders["left"]) : 0)) + "px";      
    }
    this.element.style.top = (this.parent.element.offsetTop - parentMenuBorders["top"] - this.menuItems[0].element.offsetTop) + "px";
  }
};

MenuContainer.prototype.close = function() {
  this.element.style.visibility = "hidden";
  this.isOpen = false;
  this.closeAll();
};

MenuContainer.prototype.closeAll = function(trigger) {
  for (var i in this.menuItems) { 
    this.menuItems[i].closeItem(trigger);
  }
};

MenuItem.prototype = MenuContainer.prototype;
function MenuItem(idOrElement, parent) {
  var menuItem = this;
  this.type = "menuItem";
  this.subMenu;
  this.init(idOrElement, parent);
  if (this.subMenu) {
    this.element.onmouseover = function() {
      menuItem.subMenu.open(); 
    }
  } else {
    if (this.root.quickCollapse) {
      this.element.onmouseover = function() {
        menuItem.parentMenu.closeAll(); 
      }
    }
  }
  var linkTag = this.element.getElementsByTagName("A")[0];
  if (linkTag) {
     linkTag.onfocus = this.element.onmouseover;
     this.link = linkTag;
     this.text = linkTag.text;
  }
  if (this.subMenu) {
    this.element.onmouseout = function() {
      if (menuItem.root.openDelayTimer) window.clearTimeout(menuItem.root.openDelayTimer);
      if (menuItem.root.closeDelayTimer) window.clearTimeout(menuItem.root.closeDelayTimer); 
      eval(menuItem.root.name + ".closingMenuItem = menuItem");
      menuItem.root.closeDelayTimer = window.setTimeout(menuItem.root.name + ".closingMenuItem.subMenu.close()", menuItem.root.closeDelayTime); 
    }
  }
}

MenuItem.prototype.openItem = function() {
  this.isOpen = true;
  if (this.subMenu) { this.subMenu.open(); }
};

MenuItem.prototype.closeItem = function(trigger) {
  this.isOpen = false;
  if (this.subMenu) { 
    if (this.subMenu != trigger) this.subMenu.close(); 
  }
};

// DEBUG

Menu.prototype.toString = function() {
   return "Menu";
}

Menu.prototype.trace = function() {
   return "root";
}

MenuContainer.prototype.toString = function() {
   return "y:"+this.getAbsOffsetTop();
}

MenuContainer.prototype.trace = function() {
   // return this.element.outerHTML.substring(0,40);
   return this;
   return (this.parent ? this.parent.trace() : "x") + " > " + this;
}

function trace(msg) {
  var ele = document.getElementById("trace");
  ele.value = msg + "\n" + ele.value;
}


var menu;

/*
 * for an example an all possible settings see:
 * dropdownmenu.js -> Menu.prototype.config
 */
function configMenu() {
  this.closeDelayTime = 300
  // this.collapseBorders = false;
}

function initMenu() {
  // don't use var here!! we will need menu as a global variable to store the closingDelay
  // the first parameter is the id of
  menu = new Menu('menu-root', 'menu', configMenu);
}




onload = initMenu;
function Imgmove(element,plen,step,type){
	if(!$step)$step = 1;
	
	try{
		 var mainbox=document.getElementById(element); 	
		 var txtbox=document.getElementById(element+"_1"); 
		 mainW = Number(GetCurrentStyle(mainbox,"width").replace("px",''));
		 txtboxW = Number(GetCurrentStyle(txtbox,"width").replace("px",''));
		 mainH = Number(GetCurrentStyle(mainbox,"height").replace("px",''));
		 txtboxH = Number(GetCurrentStyle(txtbox,"height").replace("px",''));
		
	}catch(e){
			
	}
	if(type=='top'){
		
		if(txtboxH-mainH-demo.scrollTop<step+10 || demo.scrollTop%plen>plen-(Math.abs(step))){
			if(step<0)
				demo.scrollTop--;
			else
				demo.scrollTop++;
		}else{
			demo.scrollTop+=step;
		}
		if(!(demo.scrollTop%plen)){
			//Í£Ö¹ ÔÙ°´¿ªÊ¼
		}
		if(demo.scrollTop>=txtboxH-mainH){
			demo.scrollLeft = 0;
		}
	}
	if(type=='left'){
		if(txtboxW-mainW-demo.scrollLeft<step+10){
			if(step<0)
				demo.scrollLeft--;
			else
				demo.scrollLeft++;
		}else{
			demo.scrollLeft+=step;
		}
		if(!(demo.scrollLeft%plen)){
			
		}
		if(demo.scrollLeft>=txtboxW-mainW){
			demo.scrollLeft = 0;
		}	
	}
}
function boxmove(d1,d2,e,pMove,obj){ 
    var speed=30; 
	var pMoveTop = false;
	var pMoveLeft = false;
	var stoptime = 100;
	try{
    var demo=document.getElementById(d1); 
	var flowH = Number(demo.style.height.replace("px",''));
	
	var flowW = Number(GetCurrentStyle(demo,"width").replace("px",''));
	
    var demo1=document.getElementById(d2);  
    var demo2=document.getElementById(d1+"_2"); 
	 demo2.innerHTML=demo1.innerHTML; 
	}catch(err){
		
		setTimeout(function(){boxmove(d1,d2,e,pMove,obj)},stoptime);
		return false;
	}
   
    function boxTop(){ 
		
			if(((demo.scrollTop)%flowH==flowH-1 && demo.scrollTop!=0 && pMove) || pMove=='nostep'){
				clearInterval(MoveTop);
				
				pMoveTop = setTimeout(function(){boxmove(d1,d2,e,pMove,obj)},stoptime);	
			}
            if(demo2.offsetTop-demo1.offsetTop-demo.scrollTop<=0){
				demo.scrollTop-=demo1.offsetHeight
			}else{
				if(pMove=='nostep')
					demo.scrollTop+=flowH
				else
					demo.scrollTop++
			} 
        } 
    function boxRight(){ 
            if(demo.scrollLeft<=0){demo.scrollLeft+=demo2.offsetWidth} 
            else{demo.scrollLeft--} 
        } 
    function boxBottom(){  
            if(demo.scrollTop<=0){demo.scrollTop+=demo2.offsetHeight} 
            else{demo.scrollTop--} 
        } 
    function boxLeft(){ 
			if(((demo.scrollLeft)%flowW==flowW-1 && demo.scrollLeft!=0 && pMove) || pMove=='nostep'){
				clearInterval(MoveLeft);
				
				pMoveLeft = setTimeout(function(){boxmove(d1,d2,e,pMove,obj)},stoptime);	
			}
            if(demo1.offsetWidth-demo.scrollLeft<=0){demo.scrollLeft-=demo1.offsetWidth;} 
            else{
				if(pMove=='nostep')
					demo.scrollLeft+=flowW
				else
					demo.scrollLeft++
			} 
        } 
    if(e==1){ 
            var MoveTop=setInterval(boxTop,speed); 
            demo.onmouseover=function(){
				clearInterval(MoveTop);
				if(pMove)clearTimeout(pMoveTop)
				} 
            demo.onmouseout=function(){
				pMoveTop = setTimeout(function(){MoveTop=setInterval(boxTop,speed)},stoptime);
				
				} 
        } 
    if(e==2){ 
            var MoveRight=setInterval(boxRight,speed); 
            demo.onmouseover=function(){clearInterval(MoveRight)} 
            demo.onmouseout=function(){MoveRight=setInterval(boxRight,speed)} 
        } 
    if(e==3){ 
            var MoveBottom=setInterval(boxBottom,speed); 
            demo.onmouseover=function(){clearInterval(MoveBottom);} 
            demo.onmouseout=function(){MoveBottom=setInterval(boxBottom,speed)} 
        } 
    if(e==4){ 
            var MoveLeft=setInterval(boxLeft,speed) 
            demo.onmouseover=function(){
				clearInterval(MoveLeft);
				if(pMove)clearTimeout(MoveLeft);
			} 
            demo.onmouseout=function(){
				pMoveLeft = setTimeout(function(){MoveLeft=setInterval(boxLeft,speed)},stoptime);
			} 
        } 
    if(e=="top"){ 
            MoveTop=setInterval(boxTop,speed) 
            obj.onmouseout=function(){clearInterval(MoveTop);} 
        } 
    if(e=="right"){ 
            MoveRight=setInterval(boxRight,speed) 
            obj.onmouseout=function(){clearInterval(MoveRight);} 
        } 
    if(e=="bottom"){ 
            MoveBottom=setInterval(boxBottom,speed) 
            obj.onmouseout=function(){clearInterval(MoveBottom);} 
        } 
    if(e=="left"){ 
            MoveLeft=setInterval(boxLeft,speed) 
            obj.onmouseout=function(){clearInterval(MoveLeft);} 
        } 
    }
	
	
	$.fn.infiniteCarousel = function () {

    function repeat(str, num) {
        return new Array( num + 1 ).join( str );
    }
  
    return this.each(function () {
        var $wrapper = $('> div', this).css('overflow', 'hidden'),
            $slider = $wrapper.find('> ul'),
            $items = $slider.find('> li'),
            $single = $items.filter(':first'),
            
            singleWidth = $single.outerWidth(), 
            visible = Math.ceil($wrapper.innerWidth() / singleWidth), 
			/*   doesn t include padding or border */
            currentPage = 1,
            pages = Math.ceil($items.length / visible);            


        // 1. Pad so that 'visible' number will always be seen, otherwise create empty items
        if (($items.length % visible) != 0) {
            $slider.append(repeat('<li class="empty" />', visible - ($items.length % visible)));
            $items = $slider.find('> li');
        }

        // 2. Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
        $items.filter(':first').before($items.slice(- visible).clone().addClass('cloned'));
        $items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned'));
        $items = $slider.find('> li'); // reselect
        
        // 3. Set the left position to the first 'real' item
        $wrapper.scrollLeft(singleWidth * visible);
        
        // 4. paging function
        function gotoPage(page) {
            var dir = page < currentPage ? -1 : 1,
                n = Math.abs(currentPage - page),
                left = singleWidth * dir * visible * n;
            
            $wrapper.filter(':not(:animated)').animate({
                scrollLeft : '+=' + left
            }, 500, function () {
                if (page == 0) {
                    $wrapper.scrollLeft(singleWidth * visible * pages);
                    page = pages;
                } else if (page > pages) {
                    $wrapper.scrollLeft(singleWidth * visible);
                    // reset back to start position
                    page = 1;
                } 

                currentPage = page;
            });                
            
            return false;
        }
        
        $wrapper.after('<a class="arrow back">&lt;</a><a class="arrow forward">&gt;</a>');
        
        // 5. Bind to the forward and back buttons
        $('a.back', this).click(function () {
            return gotoPage(currentPage - 1);                
        });
        
        $('a.forward', this).click(function () {
            return gotoPage(currentPage + 1);
        });
        
        // create a public interface to move to a specific page
        $(this).bind('goto', function (event, page) {
            gotoPage(page);
        });
    });  
};

$(document).ready(function () {
							
  $('.infiniteCarousel').infiniteCarousel();
  try{$("#d1").magnify();}catch(e){}
});
var clickmessage="£¡£¡£¡" 

function disableclick(e) {
	
if (document.all) { 

 document.oncontextmenu=new Function("event.returnValue=true;");
if (event.button==2||event.button==3) { 
if (event.srcElement.tagName=="IMG" || event.srcElement.tagName=="AREA"){ 
 document.oncontextmenu=new Function("event.returnValue=false;");  
return false; 
} 
} 
} 
else if (document.layers) { 
if (e.which == 3) { 
e.cancelBubble = true 
return false; 
} 
} 
else if (document.getElementById){ 
if (e.which==3&&e.target.tagName=="IMG"){ 
e.cancelBubble = true 
return false 
} 
} 
} 

function associateimages(){ 
for(i=0;i<document.images.length;i++) 
document.images[i].onmousedown=disableclick; 
} 

if (document.all||document.getElementById) 
document.onmousedown=disableclick 
else if (document.layers) 
associateimages() 

function sh(id){
	if(!id)return false;
	var objs = document.getElementById('menutxt').getElementsByTagName('div');
	var imgs = document.getElementById('menutxt').getElementsByTagName('img');
	for(key in objs){
		try{
		if(objs[key].id.indexOf(id)===2){//his child
			if(objs[key].id.length>=id.length+5){
				if(objs[key].style.display=='none'){
					if(objs[key].id.length==id.length+5)objs[key].style.display='block';
				}else{
					objs[key].style.display='none';
				}
			}
		}else{//other div
			if(objs[key].id.indexOf('a_')===0 && objs[key].id.length>=id.length+5){
				//objs[key].style.display='none';
			}
		}
	}catch(e){}}
	
	for(var imgi=0;imgi<imgs.length;imgi++){
		if(id.indexOf(imgs[imgi].id)===0){
			imgs[imgi].src = '/images/-.gif';
		}else{
			imgs[imgi].src = '/images/+.gif';
		}
	}
}


