/* =========================================================
// JavaScript Document
// Author: maesinfo jason
// Web: http://www.maesinfo.com
========================================================= */
/* jquery.flipv.js =============================== */
(function($){

$.fn.flipv = function(options) {
	this.each(function(){ 	
		var htmlsav = $(this).html();
		var textsav = $(this).text();
		var fontsizesav = '10';
		if ($(this).css('font-size') != '') {
			fontsizesav = parseInt($(this).css('font-size'));
		}
//		var heightsav = $(this).height();
//		var widthsav = textsav.length*fontsizesav*.60;
		var heightsav=174;
		var widthsav=30;
		
		//var colorsav = '#3a0404';
		//if ($(this).css('color'))
		//	colorsav = $(this).css('color');
			
		if ($.browser.msie) {
			$(this).css('writing-mode','tb-rl');
		} else {
			var my_id = "canvas"+parseInt(Math.random()*1000);
			$(this).empty().append("<canvas id='"+my_id+"'>"+htmlsav+"</canvas>");
			vertical_text(textsav, fontsizesav, my_id);
		}
		
	});
	return $(this);
};
})(jQuery);

function vertical_text(mytext, fontsize, my_id){
	var canvas = document.getElementById(my_id);
	if (canvas.getContext){
		var context = canvas.getContext('2d');
		set_textRenderContext(context);
		if(check_textRenderContext(context)) {
			context.translate(80,0);
			context.rotate(Math.PI/2);
			//context.strokeStyle = colorsav;
			context.strokeText(mytext,3,57,fontsize-2);
			
		}
	}
}
/* jquery.flipv.js  end =============================== */


/* SeViR Simple Horizontal Accordion =============================== */

jQuery.fn.extend({
  haccordion: function(params){
    var jQ = jQuery;
    var params = jQ.extend({
      speed:500,
      headerclass:"header",
      contentclass:"content",
      contentwidth:500
    },params);
    return this.each(function(){
      jQ("."+params.headerclass,this).click(function(){
        var p = jQ(this).parent()[0];//alert($(this).parent().eq(0).html())
        if(p.opened!= "undefined"){
			jQ(".header").removeClass("selected");
          	jQ(p.opened).next("div."+params.contentclass).animate({
            width:"0px"
          },params.speed);
        }
		jQ(".header");
        p.opened = this;
      	  jQ(this).addClass("selected")
		  .next("div."+params.contentclass)
		  .animate({width:params.contentwidth + "px"
       	 }, params.speed);
      });
    });
  }
});

/* SeViR Simple Horizontal Accordion end =============================== */


/* idTabs ~ Sean Catchpole =============================== */
(function(){var dep={"jQuery":"http://code.jquery.com/jquery-latest.min.js"};var init=function(){(function($){$.fn.idTabs=function(){var s={};for(var i=0;i<arguments.length;++i){var a=arguments[i];switch(a.constructor){case Object:$.extend(s,a);break;case Boolean:s.change=a;break;case Number:s.start=a;break;case Function:s.click=a;break;case String:if(a.charAt(0)=='.')s.selected=a;else if(a.charAt(0)=='!')s.event=a;else s.start=a;break;}}
if(typeof s['return']=="function")
s.change=s['return'];return this.each(function(){$.idTabs(this,s);});}
$.idTabs=function(tabs,options){var meta=($.metadata)?$(tabs).metadata():{};var s=$.extend({},$.idTabs.settings,meta,options);if(s.selected.charAt(0)=='.')s.selected=s.selected.substr(1);if(s.event.charAt(0)=='!')s.event=s.event.substr(1);if(s.start==null)s.start=-1;var showId=function(){if($(this).is('.'+s.selected))
return s.change;var id="#"+this.href.split('#')[1];var aList=[];var idList=[];$("a",tabs).each(function(){if(this.href.match(/#/)){aList.push(this);idList.push("#"+this.href.split('#')[1]);}});if(s.click&&!s.click.apply(this,[id,idList,tabs,s]))return s.change;for(i in aList)$(aList[i]).removeClass(s.selected);for(i in idList)$(idList[i]).hide();$(this).addClass(s.selected);$(id).show();return s.change;}
var list=$("a[href*='#']",tabs).unbind(s.event,showId).bind(s.event,showId);list.each(function(){$("#"+this.href.split('#')[1]).hide();});var test=false;if((test=list.filter('.'+s.selected)).length);else if(typeof s.start=="number"&&(test=list.eq(s.start)).length);else if(typeof s.start=="string"&&(test=list.filter("[href*='#"+s.start+"']")).length);if(test){test.removeClass(s.selected);test.trigger(s.event);}
return s;}
$.idTabs.settings={start:0,change:false,click:null,selected:".selected",event:"mouseover"};$.idTabs.version="2.2";$(function(){$(".idTabs").idTabs();});})(jQuery);}
var check=function(o,s){s=s.split('.');while(o&&s.length)o=o[s.shift()];return o;}
var head=document.getElementsByTagName("head")[0];var add=function(url){var s=document.createElement("script");s.type="text/javascript";s.src=url;head.appendChild(s);}
var s=document.getElementsByTagName('script');var src=s[s.length-1].src;var ok=true;for(d in dep){if(check(this,d))continue;ok=false;add(dep[d]);}if(ok)return init();add(src);})();
/* idTabs ~ Sean Catchpole end=============================== */


 /* jQuery-Plugin "pngFix" =============================== */

(function($){

jQuery.fn.pngFix = function(settings){
	// Settings
	settings = jQuery.extend({
		blankgif:'spacer.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {
		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale'),";
				//jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity='80'),";
			}
		});
	}
	
	return jQuery;
};

})(jQuery);

 /* jQuery-Plugin "pngFix" end =============================== */
 
 
 /*jQuery-Plugin "middle layout"====================================*/
 jQuery.fn.showMsg=function(json)
{	
	if(json==null)
		json={};
	var bodyScrollSize=this.getBodyScrollSize();
	var bodySize=this.getBodySize();
	var left=bodyScrollSize.left;
	var top=bodyScrollSize.top;
	if(json.autoMiddle!=true)
	{
		if(json.left)left=left+json.left;
		if(json.top)top=top+json.top;
	}
	else if(json.autoMiddle==true)
	{
		var _w=this.width();
		var _h=this.height();
		top=(bodySize.height-_h)/2 + top;
		left=(bodySize.width-_w)/2;
	}
	if(top+this.height()>bodyScrollSize.height)
		bodyScrollSize.height=top+this.height();
	if(left+this.width()>bodyScrollSize.width)
		bodyScrollSize.width=left+this.width();
	
	if(json.coverBody==true)
	{
		$("<iframe id='jq_effect_backGroundIframe' style='z-index:1;filter:mask();overflow:hidden;border:0px;margin:0; padding:0;position:absolute;width:"+bodyScrollSize.width+"px;height:"+bodyScrollSize.height+"px;top:0px;left:0px' scrolling='auto' frameborder='0' ></iframe>").appendTo("body"); 
		var jqCover=$("<div id='jq_effect_backGroundDiv'></div>");
		var _css = { "background-color":json.color==undefined?"#000":json.color, "position":"absolute","overflow":"hidden", "-moz-opacity": "0.5" , "filter":"alpha(opacity=50)","z-index":"2" ,"opacity":"0.5", "top" : "0px" , "left":"0px","width":bodyScrollSize.width,"height":bodyScrollSize.height };         
		jqCover.css(_css); 
		jqCover.appendTo("body"); 
	}
	if(typeof(json.msg)!="undefined")
		this.html(json.msg);
	this.css("height","auto");
	this.css("position","absolute").css("z-index","300");
	this.css("left",left+"px").css("top",top+"px").fadeIn("slow");
	if(jQuery.msgShowObj!=undefined)
	{
		try{jQuery.msgShowObj.fadeOut('slow');}catch(e){};
	}
	jQuery.msgShowObj=this;
	if(typeof(json.callback)!="undefined")
		jQuery.msgCallBack=json.callback;
	else
		jQuery.msgCallBack=null;
	jQuery.cc=undefined;
	if(json.autoClose!=false)
	{
		jQuery.cc=window.setTimeout("try{jQuery.msgShowObj.closeMsg();}catch(e){}",json.time==undefined?2000:json.time);
	}
	return this;
}
jQuery.fn.closeMsg=function()
{
	this.fadeOut('slow',jQuery.msgCallBack);
	jQuery.msgShowObj=undefined;
	$('#jq_effect_backGroundIframe').remove();
	$('#jq_effect_backGroundDiv').remove();
	return this;
}

jQuery.fn.getBodyScrollSize=function()
{
	var bodySL, bodyST, bodySW, bodySH; 
	var oh=$("#videoPop").height();
	var ow=$("#videoPop").width();
	if(window.pageXOffset) 
	{
		bodySL=window.pageXOffset; 
		bodySW=window.innerWidth; 
		bodyST=window.pageYOffset; 
		bodySH=window.innerHeight; 
	}
	else if(document.documentElement) 
	{	
		bodySL=document.documentElement.scrollLeft; 
		bodySW=document.documentElement.scrollWidth; //-10
		bodyST=document.documentElement.scrollTop; 
		bodySH=document.documentElement.clientHeight>document.documentElement.scrollHeight?document.documentElement.clientHeight:document.documentElement.scrollHeight;
	}
	else if(document.body) 
	{
		bodySL=document.body.scrollLeft; 
		bodySW=document.body.scrollWidth; 
		bodyST=document.body.scrollTop; 
		bodySH=document.body.clientHeight>document.body.scrollHeight?document.body.clientHeight:document.body.scrollHeight;
	}

	return {"top":bodyST,"left":bodySL,"width":bodySW,"height":bodySH};
}

jQuery.fn.getBodySize=function()
{
	var bodyCW, bodyCH; 
	if(window.innerWidth) 
		bodyCW=window.innerWidth; 
	else if(document.documentElement&&document.documentElement.clientWidth) 
		bodyCW=document.documentElement.clientWidth; 
	else if(document.body) 
		bodyCW=document.body.clientWidth; //author: meizz 

	if(window.innerHeight) 
		bodyCH=window.innerHeight; 
	else if(document.documentElement&&document.documentElement.clientHeight) 
		bodyCH=document.documentElement.clientHeight; 
	else if(document.body) 
		bodyCH=document.body.clientHeight; 
	
	return {"width":bodyCW,"height":bodyCH};
}

 /*jQuery-Plugin "middle layout" end====================================*/