﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/
function setCwinHeight(obj)
{
  var cwin=obj;
  if (document.getElementById)
  {
    if (cwin && !window.opera)
    {
      if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight)
        cwin.height = cwin.contentDocument.body.offsetHeight; //FF NS
      else if(cwin.Document && cwin.Document.body.scrollHeight)
        cwin.height = cwin.Document.body.scrollHeight; //IE
    }
    else if(window.opera)
    {
        if(cwin.contentWindow.document && cwin.contentWindow.document.body.scrollHeight)
            cwin.height = cwin.contentWindow.document.body.scrollHeight; //Opera
    }
  }
}

$(document).ready(function(){
	$(".tmenu > li").mouseover(function(e){
		switch(e.target.id){
			case "hotspot_today":
				//change status & style menu
				$("#hotspot_today").addClass("active");
				$("#hotspot_web").removeClass("active");
				//display selected division, hide others
				$("div.hotspot_web").css("display", "none");
				$("div.hotspot_today").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("hotspot_today_iframe"));
			break;
			case "hotspot_web":
				//change status & style menu
				$("#hotspot_today").removeClass("active");
				$("#hotspot_web").addClass("active");
				//display selected division, hide others
				$("div.hotspot_today").css("display", "none");
				$("div.hotspot_web").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("hotspot_web_iframe"));

			break;
			case "kaiji_top5":
				//change status & style menu
				$("#kaiji_top5").addClass("active");
				$("#kaiji_last5").removeClass("active");
				//display selected division, hide others
				$("div.kaiji_last5").css("display", "none");
				$("div.kaiji_top5").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("kaiji_top5_iframe"));
			break;
			case "kaiji_last5":
				//change status & style menu
				$("#kaiji_top5").removeClass("active");
				$("#kaiji_last5").addClass("active");
				//display selected division, hide others
				$("div.kaiji_top5").css("display", "none");
				$("div.kaiji_last5").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("kaiji_last5_iframe"));
			break;
			case "fengji_top5":
				//change status & style menu
				$("#fengji_top5").addClass("active");
				$("#fengji_last5").removeClass("active");
				//display selected division, hide others
				$("div.fengji_last5").css("display", "none");
				$("div.fengji_top5").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("fengji_top5_iframe"));
			break;
			case "fengji_last5":
				//change status & style menu
				$("#fengji_top5").removeClass("active");
				$("#fengji_last5").addClass("active");
				//display selected division, hide others
				$("div.fengji_top5").css("display", "none");
				$("div.fengji_last5").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("fengji_last5_iframe"));
			break;
			case "lof_top5":
				//change status & style menu
				$("#lof_top5").addClass("active");
				$("#lof_last5").removeClass("active");
				//display selected division, hide others
				$("div.lof_last5").css("display", "none");
				$("div.lof_top5").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("lof_top5_iframe"));
			break;
			case "lof_last5":
				//change status & style menu
				$("#lof_top5").removeClass("active");
				$("#lof_last5").addClass("active");
				//display selected division, hide others
				$("div.lof_top5").css("display", "none");
				$("div.lof_last5").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("lof_last5_iframe"));
			break;
			case "etf_top5":
				//change status & style menu
				$("#etf_top5").addClass("active");
				$("#etf_last5").removeClass("active");
				//display selected division, hide others
				$("div.etf_last5").css("display", "none");
				$("div.etf_top5").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("etf_top5_iframe"));
			break;
			case "etf_last5":
				//change status & style menu
				$("#etf_top5").removeClass("active");
				$("#etf_last5").addClass("active");
				//display selected division, hide others
				$("div.etf_top5").css("display", "none");
				$("div.etf_last5").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("etf_last5_iframe"));
			break;
			case "sshq":
				//change status & style menu
				$("#sshq").addClass("active");
				$("#dbmn").removeClass("active");
				$("#dtmn").removeClass("active");
				$("#lsjz").removeClass("active");
				//display selected division, hide others
				$("div.dbmn").css("display", "none");
				$("div.dtmn").css("display", "none");
				$("div.lsjz").css("display", "none");
				$("div.sshq").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("sshq_iframe"));
			break;
			case "dbmn":
				//change status & style menu
				$("#sshq").removeClass("active");
				$("#dbmn").addClass("active");
				$("#dtmn").removeClass("active");
				$("#lsjz").removeClass("active");
				//display selected division, hide others
				$("div.sshq").css("display", "none");
				$("div.dtmn").css("display", "none");
				$("div.lsjz").css("display", "none");
				$("div.dbmn").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("dbmn_iframe"));
			break;
			case "dtmn":
				//change status & style menu
				$("#sshq").removeClass("active");
				$("#dbmn").removeClass("active");
				$("#dtmn").addClass("active");
				$("#lsjz").removeClass("active");
				//display selected division, hide others
				$("div.sshq").css("display", "none");
				$("div.dbmn").css("display", "none");
				$("div.lsjz").css("display", "none");
				$("div.dtmn").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("dtmn_iframe"));
			break;
			case "lsjz":
				//change status & style menu
				$("#sshq").removeClass("active");
				$("#dbmn").removeClass("active");
				$("#dtmn").removeClass("active");
				$("#lsjz").addClass("active");
				//display selected division, hide others
				$("div.sshq").css("display", "none");
				$("div.dbmn").css("display", "none");
				$("div.dtmn").css("display", "none");
				$("div.lsjz").css("display", "block").fadeIn(30);
				setCwinHeight(document.getElementById("lsjz_iframe"));
			break;
		}
		//alert(e.target.id);
		return false;
	});
	
	//交易页面左侧menu ******** start
	$('#column_menu li ul').hide();
	$('#column_menu li span').click(function(event){
		if (this == event.target) {
		    var $ishidden = false;
		    if ($(this).siblings('ul').is(':hidden')) {
			    $ishidden = true;
		    }
		    $('#column_menu li ul').hide();
		    if ($ishidden) {
			    $(this).siblings('ul').slideDown('normal');
		    } else {
			    $(this).siblings('ul').show();
			}
		}
		return false;
	}).css('cursor','pointer');
	/*
	$('.sub li a', $('#column_menu')).mouseover(function(){
		$(this).addClass('hover');
	}).mouseout(function(){
	    $(this).removeClass('hover');
	});
	
	$('.sub li a', $('#column_menu')).click(function() {
		$('.sub li a', $('#column_menu')).removeClass('click').addClass('other');
		$(this).removeClass('other').addClass('click');
		return false;
	});*/
	
	//交易页面左侧menu ******** end
});



































