﻿function date(){
  var date=document.lastModified;
  document.write(date);
}


/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */

// Offering a Custom Alias suport - More info: http://docs.jquery.com/Plugins/Authoring#Custom_Alias
(function($) {
	/**
	 * $ is an alias to jQuery object
	 *
	 */
	$.fn.lightBox = function(settings) {
		// Settings to configure the jQuery lightBox plugin how you like
		settings = jQuery.extend({
			// Configuration related to overlay
			overlayBgColor: 		'#000',		// (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
			overlayOpacity:			0.8,		// (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9
			// Configuration related to navigation
			fixedNavigation:		false,		// (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface.
			// Configuration related to images
			imageLoading:			'/PublishingImages/lightbox/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
			imageBtnPrev:			'/PublishingImages/lightbox/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
			imageBtnNext:			'/PublishingImages/lightbox/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
			imageBtnClose:			'/PublishingImages/lightbox/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
			imageBlank:				'/PublishingImages/lightbox/lightbox-blank.gif',			// (string) Path and the name of a blank image (one pixel)
			// Configuration related to container image box
			containerBorderSize:	10,			// (integer) If you adjust the padding in the CSS for the container, #lightbox-container-image-box, you will need to update this value
			containerResizeSpeed:	400,		// (integer) Specify the resize duration of container image. These number are miliseconds. 400 is default.
			// Configuration related to texts in caption. For example: Image 2 of 8. You can alter either "Image" and "of" texts.
			txtImage:				'Image',	// (string) Specify text "Image"
			txtOf:					'of',		// (string) Specify text "of"
			// Configuration related to keyboard navigation
			keyToClose:				'c',		// (string) (c = close) Letter to close the jQuery lightBox interface. Beyond this letter, the letter X and the SCAPE key is used to.
			keyToPrev:				'p',		// (string) (p = previous) Letter to show the previous image
			keyToNext:				'n',		// (string) (n = next) Letter to show the next image.
			// Donｴt alter these variables in any way
			imageArray:				[],
			activeImage:			0
		},settings);
		// Caching the jQuery object with all elements matched
		var jQueryMatchedObj = this; // This, in this context, refer to jQuery object
		/**
		 * Initializing the plugin calling the start function
		 *
		 * @return boolean false
		 */
		function _initialize() {
			_start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked
			return false; // Avoid the browser following the link
		}
		/**
		 * Start the jQuery lightBox plugin
		 *
		 * @param object objClicked The object (link) whick the user have clicked
		 * @param object jQueryMatchedObj The jQuery object with all elements matched
		 */
		function _start(objClicked,jQueryMatchedObj) {
			// Hime some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
			$('embed, object, select').css({ 'visibility' : 'hidden' });
			// Call the function to create the markup structure; style some elements; assign events in some elements.
			_set_interface();
			// Unset total images in imageArray
			settings.imageArray.length = 0;
			// Unset image active information
			settings.activeImage = 0;
			// We have an image set? Or just an image? Letｴs see it.
			if ( jQueryMatchedObj.length == 1 ) {
				settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));
			} else {
				// Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references		
				for ( var i = 0; i < jQueryMatchedObj.length; i++ ) {
					settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));
				}
			}
			while ( settings.imageArray[settings.activeImage][0] != objClicked.getAttribute('href') ) {
				settings.activeImage++;
			}
			// Call the function that prepares image exibition
			_set_image_to_view();
		}
		/**
		 * Create the jQuery lightBox plugin interface
		 *
		 * The HTML markup will be like that:
			<div id="jquery-overlay"></div>
			<div id="jquery-lightbox">
				<div id="lightbox-container-image-box">
					<div id="lightbox-container-image">
						<img src="../fotos/XX.jpg" id="lightbox-image">
						<div id="lightbox-nav">
							<a href="#" id="lightbox-nav-btnPrev"></a>
							<a href="#" id="lightbox-nav-btnNext"></a>
						</div>
						<div id="lightbox-loading">
							<a href="#" id="lightbox-loading-link">
								<img src="../images/lightbox-ico-loading.gif" />
							</a>
						</div>
					</div>
				</div>
				<div id="lightbox-container-image-data-box">
					<div id="lightbox-container-image-data">
						<div id="lightbox-image-details">
							<span id="lightbox-image-details-caption"></span>
							<span id="lightbox-image-details-currentNumber"></span>
						</div>
						<div id="lightbox-secNav">
							<a href="#" id="lightbox-secNav-btnClose">
								<img src="../images/lightbox-btn-close.gif" />
							</a>
						</div>
					</div>
				</div>
			</div>
		 *
		 */
		function _set_interface() {
			// Apply the HTML markup into body tag
			$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>');	
			// Get page sizes
			var arrPageSizes = ___getPageSize();
			// Style overlay and show it
			$('#jquery-overlay').css({
				backgroundColor:	settings.overlayBgColor,
				opacity:			settings.overlayOpacity,
				width:				arrPageSizes[0],
				height:				arrPageSizes[1]
			}).fadeIn();
			// Get page scroll
			var arrPageScroll = ___getPageScroll();
			// Calculate top and left offset for the jquery-lightbox div object and show it
			$('#jquery-lightbox').css({
				top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
				left:	arrPageScroll[0]
			}).show();
			// Assigning click events in elements to close overlay
			$('#jquery-overlay,#jquery-lightbox').click(function() {
				_finish();									
			});
			// Assign the _finish function to lightbox-loading-link and lightbox-secNav-btnClose objects
			$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function() {
				_finish();
				return false;
			});
			// If window was resized, calculate the new overlay dimensions
			$(window).resize(function() {
				// Get page sizes
				var arrPageSizes = ___getPageSize();
				// Style overlay and show it
				$('#jquery-overlay').css({
					width:		arrPageSizes[0],
					height:		arrPageSizes[1]
				});
				// Get page scroll
				var arrPageScroll = ___getPageScroll();
				// Calculate top and left offset for the jquery-lightbox div object and show it
				$('#jquery-lightbox').css({
					top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
					left:	arrPageScroll[0]
				});
			});
		}
		/**
		 * Prepares image exibition; doing a imageｴs preloader to calculate itｴs size
		 *
		 */
		function _set_image_to_view() { // show the loading


			// Show the loading


			$('#lightbox-loading').show();


			if ( settings.fixedNavigation ) {


				$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();


			} else {


				// Hide some elements


				$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();


			}


			// Image preload process


			var objImagePreloader = new Image();


			objImagePreloader.onload = function() {


				$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);


				// Perfomance an effect in the image container resizing it


				_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);


				//	clear onLoad, IE behaves irratically with animated gifs otherwise


				objImagePreloader.onload=function(){};


			};


			objImagePreloader.src = settings.imageArray[settings.activeImage][0];


		};


		/**


		 * Perfomance an effect in the image container resizing it


		 *


		 * @param integer intImageWidth The imageｴs width that will be showed


		 * @param integer intImageHeight The imageｴs height that will be showed


		 */


		function _resize_container_image_box(intImageWidth,intImageHeight) {


			// Get current width and height


			var intCurrentWidth = $('#lightbox-container-image-box').width();


			var intCurrentHeight = $('#lightbox-container-image-box').height();


			// Get the width and height of the selected image plus the padding


			var intWidth = (intImageWidth + (settings.containerBorderSize * 2)); // Plus the imageｴs width and the left and right padding value


			var intHeight = (intImageHeight + (settings.containerBorderSize * 2)); // Plus the imageｴs height and the left and right padding value


			// Diferences


			var intDiffW = intCurrentWidth - intWidth;


			var intDiffH = intCurrentHeight - intHeight;


			// Perfomance the effect


			$('#lightbox-container-image-box').animate({ width: intWidth, height: intHeight },settings.containerResizeSpeed,function() { _show_image(); });


			if ( ( intDiffW == 0 ) && ( intDiffH == 0 ) ) {


				if ( $.browser.msie ) {


					___pause(250);


				} else {


					___pause(100);	


				}


			} 


			$('#lightbox-container-image-data-box').css({ width: intImageWidth });


			$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ height: intImageHeight + (settings.containerBorderSize * 2) });


		};


		/**


		 * Show the prepared image


		 *


		 */


		function _show_image() {


			$('#lightbox-loading').hide();


			$('#lightbox-image').fadeIn(function() {


				_show_image_data();


				_set_navigation();


			});


			_preload_neighbor_images();


		};


		/**


		 * Show the image information


		 *


		 */


		function _show_image_data() {


			$('#lightbox-container-image-data-box').slideDown('fast');


			$('#lightbox-image-details-caption').hide();


			if ( settings.imageArray[settings.activeImage][1] ) {


				$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();


			}


			// If we have a image set, display 'Image X of X'


			if ( settings.imageArray.length > 1 ) {


				$('#lightbox-image-details-currentNumber').html(settings.txtImage + ' ' + ( settings.activeImage + 1 ) + ' ' + settings.txtOf + ' ' + settings.imageArray.length).show();


			}		


		}


		/**


		 * Display the button navigations


		 *


		 */


		function _set_navigation() {


			$('#lightbox-nav').show();





			// Instead to define this configuration in CSS file, we define here. And itｴs need to IE. Just.


			$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });


			


			// Show the prev button, if not the first image in set


			if ( settings.activeImage != 0 ) {


				if ( settings.fixedNavigation ) {


					$('#lightbox-nav-btnPrev').css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' })


						.unbind()


						.bind('click',function() {


							settings.activeImage = settings.activeImage - 1;


							_set_image_to_view();


							return false;


						});


				} else {


					// Show the images button for Next buttons


					$('#lightbox-nav-btnPrev').unbind().hover(function() {


						$(this).css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' });


					},function() {


						$(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });


					}).show().bind('click',function() {


						settings.activeImage = settings.activeImage - 1;


						_set_image_to_view();


						return false;


					});


				}


			}


			


			// Show the next button, if not the last image in set


			if ( settings.activeImage != ( settings.imageArray.length -1 ) ) {


				if ( settings.fixedNavigation ) {


					$('#lightbox-nav-btnNext').css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' })


						.unbind()


						.bind('click',function() {


							settings.activeImage = settings.activeImage + 1;


							_set_image_to_view();


							return false;


						});


				} else {


					// Show the images button for Next buttons


					$('#lightbox-nav-btnNext').unbind().hover(function() {


						$(this).css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' });


					},function() {


						$(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });


					}).show().bind('click',function() {


						settings.activeImage = settings.activeImage + 1;


						_set_image_to_view();


						return false;


					});


				}


			}


			// Enable keyboard navigation


			_enable_keyboard_navigation();


		}


		/**


		 * Enable a support to keyboard navigation


		 *


		 */


		function _enable_keyboard_navigation() {


			$(document).keydown(function(objEvent) {


				_keyboard_action(objEvent);


			});


		}


		/**


		 * Disable the support to keyboard navigation


		 *


		 */


		function _disable_keyboard_navigation() {


			$(document).unbind();


		}


		/**


		 * Perform the keyboard actions


		 *


		 */


		function _keyboard_action(objEvent) {


			// To ie


			if ( objEvent == null ) {


				keycode = event.keyCode;


				escapeKey = 27;


			// To Mozilla


			} else {


				keycode = objEvent.keyCode;


				escapeKey = objEvent.DOM_VK_ESCAPE;


			}


			// Get the key in lower case form


			key = String.fromCharCode(keycode).toLowerCase();


			// Verify the keys to close the ligthBox


			if ( ( key == settings.keyToClose ) || ( key == 'x' ) || ( keycode == escapeKey ) ) {


				_finish();


			}


			// Verify the key to show the previous image


			if ( ( key == settings.keyToPrev ) || ( keycode == 37 ) ) {


				// If weｴre not showing the first image, call the previous


				if ( settings.activeImage != 0 ) {


					settings.activeImage = settings.activeImage - 1;


					_set_image_to_view();


					_disable_keyboard_navigation();


				}


			}


			// Verify the key to show the next image


			if ( ( key == settings.keyToNext ) || ( keycode == 39 ) ) {


				// If weｴre not showing the last image, call the next


				if ( settings.activeImage != ( settings.imageArray.length - 1 ) ) {


					settings.activeImage = settings.activeImage + 1;


					_set_image_to_view();


					_disable_keyboard_navigation();


				}


			}


		}


		/**


		 * Preload prev and next images being showed


		 *


		 */


		function _preload_neighbor_images() {


			if ( (settings.imageArray.length -1) > settings.activeImage ) {


				objNext = new Image();


				objNext.src = settings.imageArray[settings.activeImage + 1][0];


			}


			if ( settings.activeImage > 0 ) {


				objPrev = new Image();


				objPrev.src = settings.imageArray[settings.activeImage -1][0];


			}


		}


		/**


		 * Remove jQuery lightBox plugin HTML markup


		 *


		 */


		function _finish() {


			$('#jquery-lightbox').remove();


			$('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); });


			// Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.


			$('embed, object, select').css({ 'visibility' : 'visible' });


		}


		/**


		 / THIRD FUNCTION


		 * getPageSize() by quirksmode.com


		 *


		 * @return Array Return an array with page width, height and window width, height


		 */


		function ___getPageSize() {


			var xScroll, yScroll;


			if (window.innerHeight && window.scrollMaxY) {	


				xScroll = window.innerWidth + window.scrollMaxX;


				yScroll = window.innerHeight + window.scrollMaxY;


			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac


				xScroll = document.body.scrollWidth;


				yScroll = document.body.scrollHeight;


			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari


				xScroll = document.body.offsetWidth;


				yScroll = document.body.offsetHeight;


			}


			var windowWidth, windowHeight;


			if (self.innerHeight) {	// all except Explorer


				if(document.documentElement.clientWidth){


					windowWidth = document.documentElement.clientWidth; 


				} else {


					windowWidth = self.innerWidth;


				}


				windowHeight = self.innerHeight;


			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode


				windowWidth = document.documentElement.clientWidth;


				windowHeight = document.documentElement.clientHeight;


			} else if (document.body) { // other Explorers


				windowWidth = document.body.clientWidth;


				windowHeight = document.body.clientHeight;


			}	


			// for small pages with total height less then height of the viewport


			if(yScroll < windowHeight){


				pageHeight = windowHeight;


			} else { 


				pageHeight = yScroll;


			}


			// for small pages with total width less then width of the viewport


			if(xScroll < windowWidth){	


				pageWidth = xScroll;		


			} else {


				pageWidth = windowWidth;


			}


			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);


			return arrayPageSize;


		};


		/**


		 / THIRD FUNCTION


		 * getPageScroll() by quirksmode.com


		 *


		 * @return Array Return an array with x,y page scroll values.


		 */


		function ___getPageScroll() {


			var xScroll, yScroll;


			if (self.pageYOffset) {


				yScroll = self.pageYOffset;


				xScroll = self.pageXOffset;


			} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict


				yScroll = document.documentElement.scrollTop;


				xScroll = document.documentElement.scrollLeft;


			} else if (document.body) {// all other Explorers


				yScroll = document.body.scrollTop;


				xScroll = document.body.scrollLeft;	


			}


			arrayPageScroll = new Array(xScroll,yScroll);


			return arrayPageScroll;


		};


		 /**


		  * Stop the code execution from a escified time in milisecond


		  *


		  */


		 function ___pause(ms) {


			var date = new Date(); 


			curDate = null;


			do { var curDate = new Date(); }


			while ( curDate - date < ms);


		 };


		// Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once


		return this.unbind('click').click(_initialize);


	};


})(jQuery); // Call and execute the function immediately passing the jQuery object




//winopen.js
function disp_flv(url){
	window.open(url, "window_name", "width=400,height=340,scrollbars=no,resizable=yes,toolbar=no,menubar=no,status=no,location=no,"); 
}

function cm_flv(url){
	window.open(url, "window_name", "width=400,height=340,scrollbars=no,resizable=yes,toolbar=no,menubar=no,status=no,location=no,"); 
}

function introduction_flv(url){
	window.open(url, "window_name", "width=400,height=340,scrollbars=no,resizable=yes,toolbar=no,menubar=no,status=no,location=no,"); 
}













/*
 * jQuery UI @VERSION
 *
 * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
;(function($) {

/** jQuery core modifications and additions **/
$.keyCode = {
	BACKSPACE: 8,
	CAPS_LOCK: 20,
	COMMA: 188,
	CONTROL: 17,
	DELETE: 46,
	DOWN: 40,
	END: 35,
	ENTER: 13,
	ESCAPE: 27,
	HOME: 36,
	INSERT: 45,
	LEFT: 37,
	NUMPAD_ADD: 107,
	NUMPAD_DECIMAL: 110,
	NUMPAD_DIVIDE: 111,
	NUMPAD_ENTER: 108,
	NUMPAD_MULTIPLY: 106,
	NUMPAD_SUBTRACT: 109,
	PAGE_DOWN: 34,
	PAGE_UP: 33,
	PERIOD: 190,
	RIGHT: 39,
	SHIFT: 16,
	SPACE: 32,
	TAB: 9,
	UP: 38
};

//Temporary mappings
var _remove = $.fn.remove;
var isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);


//Helper functions and ui object
$.ui = {
	
	version: "@VERSION",
	
	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
	plugin: {
		add: function(module, option, set) {
			var proto = $.ui[module].prototype;
			for(var i in set) {
				proto.plugins[i] = proto.plugins[i] || [];
				proto.plugins[i].push([option, set[i]]);
			}
		},
		call: function(instance, name, args) {
			var set = instance.plugins[name];
			if(!set) { return; }
			
			for (var i = 0; i < set.length; i++) {
				if (instance.options[set[i][0]]) {
					set[i][1].apply(instance.element, args);
				}
			}
		}	
	},
	
	cssCache: {},
	css: function(name) {
		if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
		var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
		
		//if (!$.browser.safari)
			//tmp.appendTo('body');
		
		//Opera and Safari set width and height to 0px instead of auto
		//Safari returns rgba(0,0,0,0) when bgcolor is not set
		$.ui.cssCache[name] = !!(
			(!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || 
			!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
		);
		try { $('body').get(0).removeChild(tmp.get(0));	} catch(e){}
		return $.ui.cssCache[name];
	},

	hasScroll: function(e, a) {
		
		//If overflow is hidden, the element might have extra content, but the user wants to hide it
		if ($(e).css('overflow') == 'hidden') { return false; }
		
		var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
			has = false;
		
		if (e[scroll] > 0) { return true; }
		
		// TODO: determine which cases actually cause this to happen
		// if the element doesn't have the scroll set, see if it's possible to
		// set the scroll
		e[scroll] = 1;
		has = (e[scroll] > 0);
		e[scroll] = 0;
		return has;
	}
};


//jQuery plugins
$.fn.extend({
	
	remove: function() {
		// Safari has a native remove event which actually removes DOM elements,
		// so we have to use triggerHandler instead of trigger (#3037).
		$("*", this).add(this).each(function() {
			$(this).triggerHandler("remove");
		});
		return _remove.apply(this, arguments );
	},
	
	enableSelection: function() {
		return this
			.attr('unselectable', 'off')
			.css('MozUserSelect', '')
			.unbind('selectstart.ui');
	},
	
	disableSelection: function() {
		return this
			.attr('unselectable', 'on')
			.css('MozUserSelect', 'none')
			.bind('selectstart.ui', function() { return false; });
	},
	
	// WAI-ARIA Semantics
	ariaRole: function(role) {
		return (role !== undefined
			
			// setter
			? this.attr("role", isFF2 ? "wairole:" + role : role)
			
			// getter
			: (this.attr("role") || "").replace(/^wairole:/, ""));
	},
	
	ariaState: function(state, value) {
		return (value !== undefined
			
			// setter
			? this.each(function(i, el) {
				(isFF2
					? el.setAttributeNS("http://www.w3.org/2005/07/aaa",
						"aaa:" + state, value)
					: $(el).attr("aria-" + state, value));
			})
			
			// getter
			: this.attr(isFF2 ? "aaa:" + state : "aria-" + state));
	}
	
});


//Additional selectors
$.extend($.expr[':'], {
	
	data: function(a, i, m) {
		return $.data(a, m[3]);
	},
	
	// TODO: add support for object, area
	tabbable: function(a, i, m) {

		var nodeName = a.nodeName.toLowerCase();
		var isVisible = function(element) {
			function checkStyles(element) {
				var style = element.style;
				return (style.display != 'none' && style.visibility != 'hidden');
			}
			
			var visible = checkStyles(element);
			
			(visible && $.each($.dir(element, 'parentNode'), function() {
				return (visible = checkStyles(this));
			}));
			
			return visible;
		};
		
		return (
			// in tab order
			a.tabIndex >= 0 &&
			
			( // filter node types that participate in the tab order
				
				// anchor tag
				('a' == nodeName && a.href) ||
				
				// enabled form element
				(/input|select|textarea|button/.test(nodeName) &&
					'hidden' != a.type && !a.disabled)
			) &&
			
			// visible on page
			isVisible(a)
		);
		
	}
	
});


// $.widget is a factory to create jQuery plugins
// taking some boilerplate code out of the plugin code
// created by Scott Gonzalez and Jorn Zaefferer
function getter(namespace, plugin, method, args) {
	function getMethods(type) {
		var methods = $[namespace][plugin][type] || [];
		return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
	}
	
	var methods = getMethods('getter');
	if (args.length == 1 && typeof args[0] == 'string') {
		methods = methods.concat(getMethods('getterSetter'));
	}
	return ($.inArray(method, methods) != -1);
}

$.widget = function(name, prototype) {
	var namespace = name.split(".")[0];
	name = name.split(".")[1];
	
	// create plugin method
	$.fn[name] = function(options) {
		var isMethodCall = (typeof options == 'string'),
			args = Array.prototype.slice.call(arguments, 1);
		
		// prevent calls to internal methods
		if (isMethodCall && options.substring(0, 1) == '_') {
			return this;
		}
		
		// handle getter methods
		if (isMethodCall && getter(namespace, name, options, args)) {
			var instance = $.data(this[0], name);
			return (instance ? instance[options].apply(instance, args)
				: undefined);
		}
		
		// handle initialization and non-getter methods
		return this.each(function() {
			var instance = $.data(this, name);
			
			// constructor
			(!instance && !isMethodCall &&
				$.data(this, name, new $[namespace][name](this, options)));
			
			// method call
			(instance && isMethodCall && $.isFunction(instance[options]) &&
				instance[options].apply(instance, args));
		});
	};
	
	// create widget constructor
	$[namespace] = $[namespace] || {};
	$[namespace][name] = function(element, options) {
		var self = this;
		
		this.widgetName = name;
		this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
		this.widgetBaseClass = namespace + '-' + name;
		
		this.options = $.extend({},
			$.widget.defaults,
			$[namespace][name].defaults,
			$.metadata && $.metadata.get(element)[name],
			options);
		
		this.element = $(element)
			.bind('setData.' + name, function(e, key, value) {
				return self._setData(key, value);
			})
			.bind('getData.' + name, function(e, key) {
				return self._getData(key);
			})
			.bind('remove', function() {
				return self.destroy();
			});
		
		this._init();
	};
	
	// add widget prototype
	$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
	
	// TODO: merge getter and getterSetter properties from widget prototype
	// and plugin prototype
	$[namespace][name].getterSetter = 'option';
};

$.widget.prototype = {
	_init: function() {},
	destroy: function() {
		this.element.removeData(this.widgetName);
	},
	
	option: function(key, value) {
		var options = key,
			self = this;
		
		if (typeof key == "string") {
			if (value === undefined) {
				return this._getData(key);
			}
			options = {};
			options[key] = value;
		}
		
		$.each(options, function(key, value) {
			self._setData(key, value);
		});
	},
	_getData: function(key) {
		return this.options[key];
	},
	_setData: function(key, value) {
		this.options[key] = value;
		
		if (key == 'disabled') {
			this.element[value ? 'addClass' : 'removeClass'](
				this.widgetBaseClass + '-disabled');
		}
	},
	
	enable: function() {
		this._setData('disabled', false);
	},
	disable: function() {
		this._setData('disabled', true);
	},
	
	_trigger: function(type, e, data) {
		var eventName = (type == this.widgetEventPrefix
			? type : this.widgetEventPrefix + type);
		e = e  || $.event.fix({ type: eventName, target: this.element[0] });
		return this.element.triggerHandler(eventName, [e, data], this.options[type]);
	}
};

$.widget.defaults = {
	disabled: false
};


/** Mouse Interaction Plugin **/

$.ui.mouse = {
	_mouseInit: function() {
		var self = this;
	
		this.element
			.bind('mousedown.'+this.widgetName, function(e) {
				return self._mouseDown(e);
			})
			.bind('click.'+this.widgetName, function(e) {
				if(self._preventClickEvent) {
					self._preventClickEvent = false;
					return false;
				}
			});
		
		// Prevent text selection in IE
		if ($.browser.msie) {
			this._mouseUnselectable = this.element.attr('unselectable');
			this.element.attr('unselectable', 'on');
		}
		
		this.started = false;
	},
	
	// TODO: make sure destroying one instance of mouse doesn't mess with
	// other instances of mouse
	_mouseDestroy: function() {
		this.element.unbind('.'+this.widgetName);
		
		// Restore text selection in IE
		($.browser.msie
			&& this.element.attr('unselectable', this._mouseUnselectable));
	},
	
	_mouseDown: function(e) {
		// we may have missed mouseup (out of window)
		(this._mouseStarted && this._mouseUp(e));
		
		this._mouseDownEvent = e;
		
		var self = this,
			btnIsLeft = (e.which == 1),
			elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
		if (!btnIsLeft || elIsCancel || !this._mouseCapture(e)) {
			return true;
		}
		
		this.mouseDelayMet = !this.options.delay;
		if (!this.mouseDelayMet) {
			this._mouseDelayTimer = setTimeout(function() {
				self.mouseDelayMet = true;
			}, this.options.delay);
		}
		
		if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
			this._mouseStarted = (this._mouseStart(e) !== false);
			if (!this._mouseStarted) {
				e.preventDefault();
				return true;
			}
		}
		
		// these delegates are required to keep context
		this._mouseMoveDelegate = function(e) {
			return self._mouseMove(e);
		};
		this._mouseUpDelegate = function(e) {
			return self._mouseUp(e);
		};
		$(document)
			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
		
		return false;
	},
	
	_mouseMove: function(e) {
		// IE mouseup check - mouseup happened when mouse was out of window
		if ($.browser.msie && !e.button) {
			return this._mouseUp(e);
		}
		
		if (this._mouseStarted) {
			this._mouseDrag(e);
			return false;
		}
		
		if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
			this._mouseStarted =
				(this._mouseStart(this._mouseDownEvent, e) !== false);
			(this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e));
		}
		
		return !this._mouseStarted;
	},
	
	_mouseUp: function(e) {
		$(document)
			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
		
		if (this._mouseStarted) {
			this._mouseStarted = false;
			this._preventClickEvent = true;
			this._mouseStop(e);
		}
		
		return false;
	},
	
	_mouseDistanceMet: function(e) {
		return (Math.max(
				Math.abs(this._mouseDownEvent.pageX - e.pageX),
				Math.abs(this._mouseDownEvent.pageY - e.pageY)
			) >= this.options.distance
		);
	},
	
	_mouseDelayMet: function(e) {
		return this.mouseDelayMet;
	},
	
	// These are placeholder methods, to be overriden by extending plugin
	_mouseStart: function(e) {},
	_mouseDrag: function(e) {},
	_mouseStop: function(e) {},
	_mouseCapture: function(e) { return true; }
};

$.ui.mouse.defaults = {
	cancel: null,
	distance: 1,
	delay: 0
};

})(jQuery);







/*
 * jQuery UI Tabs @VERSION
 *
 * Copyright (c) 2007, 2008 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Tabs
 *
 * Depends:
 *	ui.core.js
 */
(function($) {

$.widget("ui.tabs", {
	_init: function() {
		// create tabs
		this._tabify(true);
	},
	_setData: function(key, value) {
		if ((/^selected/).test(key))
			this.select(value);
		else {
			this.options[key] = value;
			this._tabify();
		}
	},
	length: function() {
		return this.$tabs.length;
	},
	_tabId: function(a) {
		return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '')
			|| this.options.idPrefix + $.data(a);
	},
	ui: function(tab, panel) {
		return {
			options: this.options,
			tab: tab,
			panel: panel,
			index: this.$tabs.index(tab)
		};
	},
	_sanitizeSelector: function(hash) {
		return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":"
	},
	_cookie: function() {
		var cookie = this.cookie || (this.cookie = 'ui-tabs-' + $.data(this.element[0]));
		return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
	},
	_tabify: function(init) {
		
		this.$lis = $('li:has(a[href])', this.element);
		this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });
		this.$panels = $([]);
		
		var self = this, o = this.options;
		
		this.$tabs.each(function(i, a) {
			// inline tab
			if (a.hash && a.hash.replace('#', '')) // Safari 2 reports '#' for an empty hash
				self.$panels = self.$panels.add(self._sanitizeSelector(a.hash));
			// remote tab
			else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"
				$.data(a, 'href.tabs', a.href); // required for restore on destroy
				$.data(a, 'load.tabs', a.href); // mutable
				var id = self._tabId(a);
				a.href = '#' + id;
				var $panel = $('#' + id);
				if (!$panel.length) {
					$panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
						.insertAfter(self.$panels[i - 1] || self.element);
					$panel.data('destroy.tabs', true);
				}
				self.$panels = self.$panels.add($panel);
			}
			// invalid tab href
			else
				o.disabled.push(i + 1);
		});
		
		// initialization from scratch
		if (init) {
			
			// attach necessary classes for styling if not present
			this.element.addClass(o.navClass);
			this.$panels.addClass(o.panelClass);
			
			// Selected tab
			// use "selected" option or try to retrieve:
			// 1. from fragment identifier in url
			// 2. from cookie
			// 3. from selected class attribute on <li>
			if (o.selected === undefined) {
				if (location.hash) {
					this.$tabs.each(function(i, a) {
						if (a.hash == location.hash) {
							o.selected = i;
							return false; // break
						}
					});
				}
				else if (o.cookie) {
					var index = parseInt(self._cookie(), 10);
					if (index && self.$tabs[index]) o.selected = index;
				}
				else if (self.$lis.filter('.' + o.selectedClass).length)
					o.selected = self.$lis.index( self.$lis.filter('.' + o.selectedClass)[0] );
			}
			o.selected = o.selected === null || o.selected !== undefined ? o.selected : 0; // first tab selected by default
			
			// Take disabling tabs via class attribute from HTML
			// into account and update option properly.
			// A selected tab cannot become disabled.
			o.disabled = $.unique(o.disabled.concat(
				$.map(this.$lis.filter('.' + o.disabledClass),
					function(n, i) { return self.$lis.index(n); } )
			)).sort();
			if ($.inArray(o.selected, o.disabled) != -1)
				o.disabled.splice($.inArray(o.selected, o.disabled), 1);
			
			// highlight selected tab
			this.$panels.addClass(o.hideClass);
			this.$lis.removeClass(o.selectedClass);
			if (o.selected !== null) {
				this.$panels.eq(o.selected).removeClass(o.hideClass);
				var classes = [o.selectedClass];
				if (o.deselectable) classes.push(o.deselectableClass);
				this.$lis.eq(o.selected).addClass(classes.join(' '));
				
				// seems to be expected behavior that the show callback is fired
				var onShow = function() {
					self._trigger('show', null,
						self.ui(self.$tabs[o.selected], self.$panels[o.selected]));
				};
				
				// load if remote tab
				if ($.data(this.$tabs[o.selected], 'load.tabs'))
					this.load(o.selected, onShow);
				// just trigger show event
				else onShow();
			}
			
			// clean up to avoid memory leaks in certain versions of IE 6
			$(window).bind('unload', function() {
				self.$tabs.unbind('.tabs');
				self.$lis = self.$tabs = self.$panels = null;
			});
			
		}
		// update selected after add/remove
		else
			o.selected = this.$lis.index( this.$lis.filter('.' + o.selectedClass)[0] );
		
		// set or update cookie after init and add/remove respectively
		if (o.cookie) this._cookie(o.selected, o.cookie);
		
		// disable tabs
		for (var i = 0, li; li = this.$lis[i]; i++)
			$(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);
		
		// reset cache if switching from cached to not cached
		if (o.cache === false) this.$tabs.removeData('cache.tabs');
		
		// set up animations
		var hideFx, showFx;
		if (o.fx) {
			if (o.fx.constructor == Array) {
				hideFx = o.fx[0];
				showFx = o.fx[1];
			}
			else hideFx = showFx = o.fx;
		}
		
		// Reset certain styles left over from animation
		// and prevent IE's ClearType bug...
		function resetStyle($el, fx) {
			$el.css({ display: '' });
			if ($.browser.msie && fx.opacity) $el[0].style.removeAttribute('filter');
		}

		// Show a tab...
		var showTab = showFx ?
			function(clicked, $show) {
				$show.animate(showFx, showFx.duration || 'normal', function() {
					$show.removeClass(o.hideClass);
					resetStyle($show, showFx);
					self._trigger('show', null, self.ui(clicked, $show[0]));
				});
			} :
			function(clicked, $show) {
				$show.removeClass(o.hideClass);
				self._trigger('show', null, self.ui(clicked, $show[0]));
			};
		
		// Hide a tab, $show is optional...
		var hideTab = hideFx ? 
			function(clicked, $hide, $show) {
				$hide.animate(hideFx, hideFx.duration || 'normal', function() {
					$hide.addClass(o.hideClass);
					resetStyle($hide, hideFx);
					if ($show) showTab(clicked, $show, $hide);
				});
			} :
			function(clicked, $hide, $show) {
				$hide.addClass(o.hideClass);
				if ($show) showTab(clicked, $show);
			};
		
		// Switch a tab...
		function switchTab(clicked, $li, $hide, $show) {
			var classes = [o.selectedClass];
			if (o.deselectable) classes.push(o.deselectableClass);
			$li.addClass(classes.join(' ')).siblings().removeClass(classes.join(' '));
			hideTab(clicked, $hide, $show);
		}
		
		// attach tab event handler, unbind to avoid duplicates from former tabifying...
		this.$tabs.unbind('.tabs').bind(o.event + '.tabs', function() {
			
			//var trueClick = e.clientX; // add to history only if true click occured, not a triggered click
			var $li = $(this).parents('li:eq(0)'),
				$hide = self.$panels.filter(':visible'),
				$show = $(self._sanitizeSelector(this.hash));
			
			// If tab is already selected and not deselectable or tab disabled or 
			// or is already loading or click callback returns false stop here.
			// Check if click handler returns false last so that it is not executed
			// for a disabled or loading tab!
			if (($li.hasClass(o.selectedClass) && !o.deselectable)
				|| $li.hasClass(o.disabledClass)
				|| $(this).hasClass(o.loadingClass)
				|| self._trigger('select', null, self.ui(this, $show[0])) === false
				) {
				this.blur();
				return false;
			}
			
			o.selected = self.$tabs.index(this);
			
			// if tab may be closed
			if (o.deselectable) {
				if ($li.hasClass(o.selectedClass)) {
					self.options.selected = null;
					$li.removeClass([o.selectedClass, o.deselectableClass].join(' '));
					self.$panels.stop();
					hideTab(this, $hide);
					this.blur();
					return false;
				} else if (!$hide.length) {
					self.$panels.stop();
					var a = this;
					self.load(self.$tabs.index(this), function() {
						$li.addClass([o.selectedClass, o.deselectableClass].join(' '));
						showTab(a, $show);
					});
					this.blur();
					return false;
				}
			}
			
			if (o.cookie) self._cookie(o.selected, o.cookie);
			
			// stop possibly running animations
			self.$panels.stop();
			
			// show new tab
			if ($show.length) {
				var a = this;
				self.load(self.$tabs.index(this), $hide.length ? 
					function() {
						switchTab(a, $li, $hide, $show);
					} :
					function() {
						$li.addClass(o.selectedClass);
						showTab(a, $show);
					}
				);
			} else
				throw 'jQuery UI Tabs: Mismatching fragment identifier.';
				
			// Prevent IE from keeping other link focussed when using the back button
			// and remove dotted border from clicked link. This is controlled via CSS
			// in modern browsers; blur() removes focus from address bar in Firefox
			// which can become a usability and annoying problem with tabs('rotate').
			if ($.browser.msie) this.blur();
			
			return false;
			
		});
		
		// disable click if event is configured to something else
		if (o.event != 'click') this.$tabs.bind('click.tabs', function(){return false;});
		
	},
	add: function(url, label, index) {
		if (index == undefined)
			index = this.$tabs.length; // append by default
		
		var o = this.options;
		var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));
		$li.data('destroy.tabs', true);
		
		var id = url.indexOf('#') == 0 ? url.replace('#', '') : this._tabId( $('a:first-child', $li)[0] );
		
		// try to find an existing element before creating a new one
		var $panel = $('#' + id);
		if (!$panel.length) {
			$panel = $(o.panelTemplate).attr('id', id)
				.addClass(o.hideClass)
				.data('destroy.tabs', true);
		}
		$panel.addClass(o.panelClass);
		if (index >= this.$lis.length) {
			$li.appendTo(this.element);
			$panel.appendTo(this.element[0].parentNode);
		} else {
			$li.insertBefore(this.$lis[index]);
			$panel.insertBefore(this.$panels[index]);
		}
		
		o.disabled = $.map(o.disabled,
			function(n, i) { return n >= index ? ++n : n });
		
		this._tabify();
		
		if (this.$tabs.length == 1) {
			$li.addClass(o.selectedClass);
			$panel.removeClass(o.hideClass);
			var href = $.data(this.$tabs[0], 'load.tabs');
			if (href)
				this.load(index, href);
		}
		
		// callback
		this._trigger('add', null, this.ui(this.$tabs[index], this.$panels[index]));
	},
	remove: function(index) {
		var o = this.options, $li = this.$lis.eq(index).remove(),
			$panel = this.$panels.eq(index).remove();
		
		// If selected tab was removed focus tab to the right or
		// in case the last tab was removed the tab to the left.
		if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)
			this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));
		
		o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
			function(n, i) { return n >= index ? --n : n });
		
		this._tabify();
		
		// callback
		this._trigger('remove', null, this.ui($li.find('a')[0], $panel[0]));
	},
	enable: function(index) {
		var o = this.options;
		if ($.inArray(index, o.disabled) == -1)
			return;
		
		var $li = this.$lis.eq(index).removeClass(o.disabledClass);
		if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...
			$li.css('display', 'inline-block');
			setTimeout(function() {
				$li.css('display', 'block');
			}, 0);
		}
		
		o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
		
		// callback
		this._trigger('enable', null, this.ui(this.$tabs[index], this.$panels[index]));
	},
	disable: function(index) {
		var self = this, o = this.options;
		if (index != o.selected) { // cannot disable already selected tab
			this.$lis.eq(index).addClass(o.disabledClass);
			
			o.disabled.push(index);
			o.disabled.sort();
			
			// callback
			this._trigger('disable', null, this.ui(this.$tabs[index], this.$panels[index]));
		}
	},
	select: function(index) {
		// TODO make null as argument work
		if (typeof index == 'string')
			index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );
		this.$tabs.eq(index).trigger(this.options.event + '.tabs');
	},
	load: function(index, callback) { // callback is for internal usage only
		
		var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0],
				bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs');
		
		callback = callback || function() {};
		
		// no remote or from cache - just finish with callback
		if (!url || !bypassCache && $.data(a, 'cache.tabs')) {
			callback();
			return;
		}
		
		// load remote from here on
		
		var inner = function(parent) {
			var $parent = $(parent), $inner = $parent.find('*:last');
			return $inner.length && $inner.is(':not(img)') && $inner || $parent;
		};
		var cleanup = function() {
			self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass)
					.each(function() {
						if (o.spinner)
							inner(this).parent().html(inner(this).data('label.tabs'));
					});
			self.xhr = null;
		};
		
		if (o.spinner) {
			var label = inner(a).html();
			inner(a).wrapInner('<em></em>')
				.find('em').data('label.tabs', label).html(o.spinner);
		}
		
		var ajaxOptions = $.extend({}, o.ajaxOptions, {
			url: url,
			success: function(r, s) {
				$(self._sanitizeSelector(a.hash)).html(r);
				cleanup();
				
				if (o.cache)
					$.data(a, 'cache.tabs', true); // if loaded once do not load them again
				
				// callbacks
				self._trigger('load', null, self.ui(self.$tabs[index], self.$panels[index]));
				try {
					o.ajaxOptions.success(r, s);
				}
				catch (e) {}
				
				// This callback is required because the switch has to take
				// place after loading has completed. Call last in order to 
				// fire load before show callback...
				callback();
			}
		});
		if (this.xhr) {
			// terminate pending requests from other tabs and restore tab label
			this.xhr.abort();
			cleanup();
		}
		$a.addClass(o.loadingClass);
		self.xhr = $.ajax(ajaxOptions);
	},
	url: function(index, url) {
		this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs', url);
	},
	destroy: function() {
		var o = this.options;
		this.element.unbind('.tabs')
			.removeClass(o.navClass).removeData('tabs');
		this.$tabs.each(function() {
			var href = $.data(this, 'href.tabs');
			if (href)
				this.href = href;
			var $this = $(this).unbind('.tabs');
			$.each(['href', 'load', 'cache'], function(i, prefix) {
				$this.removeData(prefix + '.tabs');
			});
		});
		this.$lis.add(this.$panels).each(function() {
			if ($.data(this, 'destroy.tabs'))
				$(this).remove();
			else
				$(this).removeClass([o.selectedClass, o.deselectableClass,
					o.disabledClass, o.panelClass, o.hideClass].join(' '));
		});
		if (o.cookie)
			this._cookie(null, o.cookie);
	}
});

$.extend($.ui.tabs, {
	version: '@VERSION',
	getter: 'length',
	defaults: {
		// basic setup
		deselectable: false,
		event: 'click',
		disabled: [],
		cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
		// Ajax
		spinner: 'Loading&#8230;',
		cache: false,
		idPrefix: 'ui-tabs-',
		ajaxOptions: null,
		// animations
		fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
		// templates
		tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>',
		panelTemplate: '<div></div>',
		// CSS class names
		navClass: 'ui-tabs-nav',
		selectedClass: 'ui-tabs-selected',
		deselectableClass: 'ui-tabs-deselectable',
		disabledClass: 'ui-tabs-disabled',
		panelClass: 'ui-tabs-panel',
		hideClass: 'ui-tabs-hide',
		loadingClass: 'ui-tabs-loading'
	}
});

/*
 * Tabs Extensions
 */

/*
 * Rotate
 */
$.extend($.ui.tabs.prototype, {
	rotation: null,
	rotate: function(ms, continuing) {
		
		continuing = continuing || false;
		
		var self = this, t = this.options.selected;
		
		function start() {
			self.rotation = setInterval(function() {
				t = ++t < self.$tabs.length ? t : 0;
				self.select(t);
			}, ms);
		}
		
		function stop(e) {
			if (!e || e.clientX) { // only in case of a true click
				clearInterval(self.rotation);
			}
		}
		
		// start interval
		if (ms) {
			start();
			if (!continuing)
				this.$tabs.bind(this.options.event + '.tabs', stop);
			else
				this.$tabs.bind(this.options.event + '.tabs', function() {
					stop();
					t = self.options.selected;
					start();
				});
		}
		// stop interval
		else {
			stop();
			this.$tabs.unbind(this.options.event + '.tabs', stop);
		}
	}
});

})(jQuery);





/***************************


	/scripts/utils.js


****************************/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document;
    n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

// window pop up function
function popWindow(url, myWidth, myHeight) {
	var winWidth, winHeight;
	if (myWidth) {
		winWidth = myWidth;
	} else {
		winWidth = 462;
	}
	
	if (myHeight) {
		winHeight = myHeight;
	} else {
		winHeight = 480;
	}
	
	var optionListing = "HEIGHT=" + winHeight + ",WIDTH=" + winWidth + ",innerHeight=480,innerWidth=462,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,screenX=10,screenY=20"
	remote = window.open(url,"sb_popup",optionListing);
	if (remote != null)  {
		remote.focus();
	} // end if
}

function popWindowScroll(url) {
	var optionListing = "HEIGHT=500,WIDTH=477,innerHeight=500,innerWidth=477,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,screenX=10,screenY=20"
	remote = window.open(url,"sb_popup",optionListing);
	if (remote != null)  {
		remote.focus();
	} // end if
}

function popWindowLarge(url) {
	var optionListing = "HEIGHT=500,WIDTH=660,innerHeight=500,innerWidth=660,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,screenX=10,screenY=20"
	remote = window.open(url,"sb_popup",optionListing);
	if (remote != null)  {
		remote.focus();
	} // end if
}

//親ウィンドウ遷移
function openerURL(URL) {
	if(opener.closed) {
		NewWin = window.open('', 'Win');
		NewWin.location.href = URL;
	} else {
		opener.location.href = URL;
	}
	opener.focus();
}

function sb_validateForm() { //v4.0
  	var i,p,q,nm,test,num,min,max,errors='',args=sb_validateForm.arguments;
  	for (i=0; i<(args.length-2); i+=3) { 
	
		test=args[i+2]; 
		val=MM_findObj(args[i]);
		if (val) { 
	
			var temp_nm=val.name;
			temp_nm=args[i];
			nm = eval(temp_nm+'_label'); 
		
			if ((val=val.value)!="") {
    	  		if (test.indexOf('isEmail')!=-1) { 
					p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) {
						errors+='- '+nm+' '+emailError+'\n';
     				}
				} else if (test!='R') { 
					num = parseFloat(val);
       				if (isNaN(val)) {
       					errors+='- '+nm+' '+numericError+'\n';
	   				}
					if (test.indexOf('inRange') != -1) { 
						p=test.indexOf(':');
        	  			min=test.substring(8,p); 
          				max=test.substring(p+1);
         				if (num<min || max<num) {
         					errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    					}
					} // end if in range
    			} // end if 
    		} else if (test.charAt(0) == 'R') {
    			errors += '- '+nm+' '+nullError+'.\n'; 
			} // end if value != ""
		} // end if val
  	} // end for loop
	
  	if (errors && errmsg != '') {
	alert(validationMessage+'\n'+errors+errmsg);
	}
	if (errors == '' && errmsg != '') {
	alert(validationMessage+'\n'+errmsg);
	}
	if (errors && errmsg == '') {
	alert(validationMessage+'\n'+errors);
	}
  document.MM_returnValue = (errors == '');
}



// Returns the entire query string passed to the current page.
function getQueryString(){ 
        zquery = parent.location.search; 
        zquery = zquery.substring(1,zquery.length); 
        return (zquery); 
} 

// Parses a query string 'queryString' for the variable 'queryName'
// and returns the value associated with that name.
function parseQuery (queryString, queryName) {
	startIndex = queryString.indexOf(queryName);
	if (startIndex == -1) {
		return "";
	}
	
	startIndex = queryString.indexOf("=", startIndex) + 1;
	endIndex = queryString.indexOf("&", startIndex);
	if (endIndex == -1) {
		endIndex = queryString.length;
	}
	return queryString.substring(startIndex, endIndex);
}

function jumpPage(url) {
	if ((url != "none") && (url != "")) {
		// Escape the value of the parameter
		paramName = url.substring(0, url.indexOf("=")+1);
		varName = escape(url.substring(url.indexOf("=") + 1, url.length));
		url =  paramName + varName;
		location.href=url;
	}
}

function changeIframe (baseUrl, defaultPage, iframeNameParam) {
	var iframeName = "externalContent";
	if ((typeof iframeNameParam != 'undefined') && (iframeNameParam != "")) {
		iframeName = iframeNameParam;
	}
	
	var subpage = parseQuery(getQueryString(), "subpage");
	//alert("subpage = " + subpage);
	if (subpage == "") {
		subpage = defaultPage;
	}
	
	iFrameObj = getObj(iframeName);
	iFrameObj.src= "http://" + baseUrl + subpage;
}


// Writes out the subsection navigation
function sb_writeSubsectionNav () {
	var sHTML = "";
	var currentLocation = location.href;
	currentLocation = currentLocation.slice(currentLocation.lastIndexOf("/")+1);
	currentSection = -1;
	currentIndex = -1;
	
	//alert("currentIndex = "+currentIndex);
	
	for (i=0; (i<subsection.length) && (currentSection < 0); i++) {
		for (j=0; (j<subsection[i].length) && (currentIndex < 0); j++) {
			if (subsection[i][j].indexOf(currentLocation) != -1) {
				//alert ("index found at "+j+" - "+i);
				currentIndex = j;
				currentSection = i;
			}
		}
	}
	
	sHTML += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
	sHTML += "<tr>";
	sHTML += "<td><img src=\"/site_images/s.gif\" width=\"1\" height=\"10\" alt=\"\"/></td>"
	sHTML += "<td  align=\"center\" valign=\"middle\" class=\"prevNext\" height=\"10\" nowrap>";
	
	if ((currentIndex-1) < 0) {
		sHTML += "<img src=\"/site_images/s.gif\" width=\"2\" height=\"1\" alt=\"\" /><span class=\"prevNextArrow\">&lt;</span><img src=\"/site_images/s.gif\" width=\"5\" height=\"1\" alt=\"\" />" + prevText ;
	} else {
		sHTML += "<img src=\"/site_images/s.gif\" width=\"2\" height=\"1\" alt=\"\" /><span class=\"prevNextArrow\">&lt;</span><img src=\"/site_images/s.gif\" width=\"5\" height=\"1\" alt=\"\" /><a href=\""  + subsection[currentSection][currentIndex-1] + "\" class=\"prevNextLink\">" + prevText + "</a>";
	}
	
	if (subsectionIndex == "") {
		sHTML += "<img src=\"/site_images/s.gif\" width=\"4\" height=\"1\" alt=\"\" />|<img src=\"/site_images/s.gif\" width=\"5\" height=\"1\" alt=\"\" />";
		sHTML += "Index";
		sHTML += "<img src=\"/site_images/s.gif\" width=\"4\" height=\"1\" alt=\"\" />|<img src=\"/site_images/s.gif\" width=\"5\" height=\"1\" alt=\"\" />";
	} else {
		sHTML += "<img src=\"/site_images/s.gif\" width=\"4\" height=\"1\" alt=\"\" />|<img src=\"/site_images/s.gif\" width=\"5\" height=\"1\" alt=\"\" />";
		sHTML += "<a href=\"" + subsectionIndex + "\" class=\"prevNextLink\">" + indexText + "</a>";
		sHTML += "<img src=\"/site_images/s.gif\" width=\"4\" height=\"1\" alt=\"\" />|<img src=\"/site_images/s.gif\" width=\"5\" height=\"1\" alt=\"\" />";
	}

	if ( (currentIndex < 0) || (currentIndex > (subsection[currentSection].length - 2)) ) {	
		sHTML += nextText + "<img src=\"/site_images/s.gif\" width=\"4\" height=\"1\" alt=\"\" /><span class=\"prevNextArrow\">&gt;</span><img src=\"/site_images/s.gif\" width=\"3\" height=\"1\" alt=\"\" />";
	} else {
		sHTML += "<a href=\"" + subsection[currentSection][currentIndex+1] +  "\" class=\"prevNextLink\">" + nextText + "</a><img src=\"/site_images/s.gif\" width=\"4\" height=\"1\" alt=\"\" /><span class=\"prevNextArrow\">&gt;</span><img src=\"/site_images/s.gif\" width=\"3\" height=\"1\" alt=\"\" />";
	}	
	sHTML += "</td>";
	sHTML += "</tr>";
	sHTML += "</table>";

	//alert(sHTML);
	document.write(sHTML);
}

/* *********************************** */
// BEGIN POLL FUNCTIONS
/* *********************************** */


// Turn Display on/off
function poll_showHideLayers() {
	var i,p,v,obj,args=poll_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) 
	if ((obj=MM_findObj(args[i]))!=null) { 
		v=args[i+2];
		if (obj.style.display) { 
			obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; 
		} 
	obj.display=v; 
	}
}

// define the default number of days for cookie expiration
var expDays = 365;

// which page should be popped for the one-time survey
var page = "/secure/GeneralContent/survey/take_survey.html";
var windowprops = "width=600,height=500,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes";

// get the specific value of the cookie
function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
		return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}

// set the cookie with an expiration equal to what is defined above
function SetCookie (name, value) {  
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}

// set the old cookie to an expired time to delete it if necessary
function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

// add 1 to the cookie if they've been here before
function amt() {
	var count = GetCookie('count')
	if(count == null) {
		SetCookie('count','1')
		return 1
	}
	else {
		var newcount = parseInt(count) + 1;
		DeleteCookie('count')
		SetCookie('count',newcount,exp);
		return count
   }
}

// get the value of the cookie, detect if it's null or not
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

// see if they've received the cookie before now
function checkCount() { 
	var count = GetCookie('count');
	if (count == null) 
	{
		count=1;
		SetCookie('count', count, exp);
		window.open(page, "", windowprops);
	}
	else
	{
		count++;
		SetCookie('count', count, exp);
   }
}

var graphimageP="/site_images/poll/poll_bar.gif";
var thePollName="";

// set the cookie to show the poll has been taken
function takePoll() {
	SetCookie('poll_Name',thePollName, exp);
}

// show the correct DIV for the poll status
function miniInit() {
 setTimeout("setPollLayer();",500);
}

function setPollLayer() {
	SetCookie('cookieEnable', "yes", exp);
	if (GetCookie('cookieEnable') == null) {
		poll_showHideLayers('pollQuestion','','hide','pollResults','','show');
	}
	else {
		if (GetCookie('poll_Name') != thePollName) {
			poll_showHideLayers('pollQuestion','','show','pollResults','','hide');
		}
		else {
			poll_showHideLayers('pollQuestion','','hide','pollResults','','show');
		}
	}
}

//DEFINE GRAPH VALUES [Item name, Percentage value]

function graphitP(grapha, graphb, gwidth) {
	var arrLen = grapha.length;
	var graphc = new Array();
	for (var arrLoop = 0; arrLoop < arrLen; arrLoop++) {
		graphc[arrLoop] = [grapha[arrLoop], graphb[arrLoop]];
	}

	outputP='<table border="0" cellspacing="0" cellpadding="0" width="100%">'
	for (i=0;i<graphc.length;i++) {
		calwidthP=gwidth*(parseInt(graphc[i][1])/100)
		outputP+='<tr><td class="sidebarCopy" colspan="3">'+graphc[i][0]+'&nbsp;:&nbsp;'+graphc[i][1]+'</td></tr><tr><td width="1"><img src="/site_images/poll/poll_left.gif" width="1" height="11"></td><td width="144" background="/site_images/poll/poll_bg.gif"><img src="/site_images/s.gif" width="1" height="2"><img src="'+graphimageP+'" width="'+calwidthP+'" height="7"></td><td width="1"><img src="/site_images/poll/poll_left.gif" width="1" height="11"></td></tr>';
		outputP+='<tr><td colspan="3"><img src="/site_images/s.gif" width="3" height="4" alt="" /></td></tr>';
	}
	outputP+='</table>';
	document.write(outputP);
}

// Disclaimer Functions

function sb_disclaimer(disc,targ,label) {
	window.open(disc + '?targ=' + targ + '&label=' + label,'', 'width=460, height=275');
}

var qsParm = new Array();
function qs() {
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
   var pos = parms[i].indexOf('=');
   if (pos > 0) {
      var key = parms[i].substring(0,pos);
      var val = parms[i].substring(pos+1);
	  val = unescape(val);
      qsParm[key] = val;
      }
   }
}

function discOpen() {
	window.open(qsParm['targ']);
	window.close();
}

qsParm['targ'] = null;
qsParm['label'] = null;
qs(); 

function checkVars(){
	if (qsParm['targ'] && qsParm['label']) {
		MM_showHideLayers('disclaimerLink','','show','error','','hide');
	} else {
		MM_showHideLayers('disclaimerLink','','hide','error','','show');
	}
}


function popMedicine(img) {

sw = window.open('', 'medicine', 'HEIGHT=700,WIDTH=740,innerHeight=500,innerWidth=477,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,screenX=10,screenY=20');

var swHTML='';

swHTML += '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n';
swHTML += '<html>\n';
swHTML += '<head>\n';
swHTML += '	<title>くすりの情報 | 万有製薬株式会社</title>\n';
swHTML += '	<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n';
swHTML += '		<meta name=\"keywords\" content=\"くすり,薬,薬品,病気,薬剤,お問い合わせ\" />\n';
swHTML += '		<meta name=\"description\" content=\"万有製薬株式会社のホームページです。\" />\n';
swHTML += '	<script language=\"JavaScript\" src=/scripts/utils.js></script>\n';
swHTML += '	<script language=\"JavaScript\" src=\"/scripts/main_nav.js\"></script>\n';
swHTML += '	<link rel=\"stylesheet\" href=\"/styles/global.css\" type=\"text/css\" />\n';
swHTML += '</head>\n';
swHTML += '<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" bgcolor=\"#ffffff\">\n';
swHTML += '<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"35\" class=\"bgPageHeading\">\n';
swHTML += '		<tr bgcolor=\"#009999\">\n';
swHTML += '			<td height=\"35\" valign=\"top\" class=\"bgPageHeading\" rowspan=\"2\"><img src=\"/site_images/header/logo_popup.gif\" alt=\"万有製薬\" /></td>\n';
swHTML += '			<td width=\"251\" height=\"2\"><img src=\"/site_images/s.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\n';
swHTML += '			<td width=\"9\" height=\"35\" rowspan=\"2\"><img src=\"/site_images/s.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\n';
swHTML += '		</tr>\n';
swHTML += '		<tr bgcolor=\"#009999\">\n';
swHTML += '			<td width=\"251\" height=\"33\" align=\"right\" valign=\"middle\"><span class=\"windowTitle\"><a href=\"javascript:window.close();"><img src=\"/site_images/header/close_popup.gif\" alt=\"ウィンドウを閉じる\" border=\"0\"></a></span></td>	\n';
swHTML += '		</tr>\n';
swHTML += '	</table>\n';
swHTML += '<br/>\n';
swHTML += '<table width=\"452\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n';
swHTML += '<tr>\n';
swHTML += '<td width=\"10\">&nbsp;</td>\n';
swHTML += '<td width=\"432\" valign=\"top\">\n';

swHTML += '<img src=\"' + img + '" alt=\"\">\n';

swHTML += '</td>\n';
swHTML += '<td width=\"10\">&nbsp;</td>\n';
swHTML += '</tr>\n';
swHTML += '</table>\n';
swHTML += '</body>\n';
swHTML += '</html>\n';

	sw.document.open();
	sw.document.write(swHTML);
	sw.document.close();
	swHTML='';

	if (sw != null)  {
		sw.focus();
	} // end if

}


function popMedicine_hcp(img) {

sw = window.open('', 'medicine', 'HEIGHT=700,WIDTH=740,innerHeight=500,innerWidth=477,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,screenX=10,screenY=20');

var swHTML='';

swHTML += '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n';
swHTML += '<html>\n';
swHTML += '<head>\n';
swHTML += '	<title>製品関連情報 ｜万有製薬株式会社</title>\n';
swHTML += '	<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n';
swHTML += '		<meta name=\"keywords\" content=\"シングレア,ニューロタン,フォサマック,リポバス,AGA,プロペシア,高血圧,高脂血症,骨粗しょう症,喘息,改訂\" />\n';
swHTML += '		<meta name=\"description\" content=\"万有製薬株式会社のホームページです。\" />\n';
swHTML += '	<script language=\"JavaScript\" src=/scripts/utils.js></script>\n';
swHTML += '	<script language=\"JavaScript\" src=\"/scripts/main_nav.js\"></script>\n';
swHTML += '	<link rel=\"stylesheet\" href=\"/styles/global.css\" type=\"text/css\" />\n';
swHTML += '</head>\n';
swHTML += '<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" bgcolor=\"#ffffff\">\n';
swHTML += '<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"35\" class=\"bgPageHeading\">\n';
swHTML += '		<tr bgcolor=\"#009999\">\n';
swHTML += '			<td height=\"35\" valign=\"top\" class=\"bgPageHeading\" rowspan=\"2\"><img src=\"/site_images/header/logo_popup.gif\" alt=\"万有製薬\" /></td>\n';
swHTML += '			<td width=\"251\" height=\"2\"><img src=\"/site_images/s.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\n';
swHTML += '			<td width=\"9\" height=\"35\" rowspan=\"2\"><img src=\"/site_images/s.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\n';
swHTML += '		</tr>\n';
swHTML += '		<tr bgcolor=\"#009999\">\n';
swHTML += '			<td width=\"251\" height=\"33\" align=\"right\" valign=\"middle\"><span class=\"windowTitle\"><a href=\"javascript:window.close();"><img src=\"/site_images/header/close_popup.gif\" alt=\"ウィンドウを閉じる\" border=\"0\"></a></span></td>	\n';
swHTML += '		</tr>\n';
swHTML += '	</table>\n';
swHTML += '<br/>\n';
swHTML += '<table width=\"452\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n';
swHTML += '<tr>\n';
swHTML += '<td width=\"10\">&nbsp;</td>\n';
swHTML += '<td width=\"432\" valign=\"top\">\n';

swHTML += '<img src=\"' + img + '" alt=\"\">\n';

swHTML += '</td>\n';
swHTML += '<td width=\"10\">&nbsp;</td>\n';
swHTML += '</tr>\n';
swHTML += '</table>\n';
swHTML += '</body>\n';
swHTML += '</html>\n';

	sw.document.open();
	sw.document.write(swHTML);
	sw.document.close();
	swHTML='';

	if (sw != null)  {
		sw.focus();
	} // end if


}


function poplipo(img) {

sw = window.open('', 'medicine', 'HEIGHT=700,WIDTH=740,innerHeight=500,innerWidth=477,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,screenX=10,screenY=20');

var swHTML='';

swHTML += '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n';
swHTML += '<html>\n';
swHTML += '<head>\n';
swHTML += '	<title>学術情報 | 万有製薬株式会社</title>\n';
swHTML += '	<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n';
swHTML += '		<meta name=\"keywords\" content=\"セミナー,文献,シングレア,フォサマック,ニューロタン,リポバス\" />\n';
swHTML += '		<meta name=\"description\" content=\"万有製薬株式会社のホームページです。\" />\n';
swHTML += '	<script language=\"JavaScript\" src=/scripts/utils.js></script>\n';
swHTML += '	<script language=\"JavaScript\" src=\"/scripts/main_nav.js\"></script>\n';
swHTML += '	<link rel=\"stylesheet\" href=\"/styles/global.css\" type=\"text/css\" />\n';
swHTML += '</head>\n';
swHTML += '<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" bgcolor=\"#ffffff\">\n';
swHTML += '<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"35\" class=\"bgPageHeading\">\n';
swHTML += '		<tr>\n';
swHTML += '			<td height=\"35\" valign=\"top\" class=\"bgPageHeading\" rowspan=\"2\"><img src=\"/site_images/header/logo_popup.gif\" alt=\"万有製薬\" /></td>\n';
swHTML += '			<td width=\"251\" height=\"2\"><img src=\"/site_images/s.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\n';
swHTML += '			<td width=\"9\" height=\"35\" rowspan=\"2\"><img src=\"/site_images/s.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\n';
swHTML += '		</tr>\n';
swHTML += '		<tr>\n';
swHTML += '			<td width=\"251\" height=\"33\" align=\"right\" valign=\"middle\"><span class=\"windowTitle\"><a href=\"javascript:window.close();"><img src=\"/site_images/header/close_popup.gif\" alt=\"ウィンドウを閉じる\" border=\"0\"></a></span></td>	\n';
swHTML += '		</tr>\n';
swHTML += '	</table>\n';
swHTML += '<br/>\n';
swHTML += '<table width=\"452\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n';
swHTML += '<tr>\n';
swHTML += '<td width=\"10\">&nbsp;</td>\n';
swHTML += '<td width=\"432\" valign=\"top\">\n';

swHTML += '<img src=\"' + img + '" alt=\"\">\n';

swHTML += '</td>\n';
swHTML += '<td width=\"10\">&nbsp;</td>\n';
swHTML += '</tr>\n';
swHTML += '</table>\n';
swHTML += '</body>\n';
swHTML += '</html>\n';

	sw.document.open();
	sw.document.write(swHTML);

	if (sw != null)  {
		sw.focus();
	} // end if


}


//selfcheck

	var gBl = new MakeArrey(21);
	var i;
	cls();

function MakeArrey(n){
	this.length = n;
	var i;
	for(i=0;i<n;++i){
		this[i]=0;
	}
}

function ChkBoxCount(){
	var s = "",i,n = 0;
	for(i=0;i<20;++i){
		if (gBl[i] == true){
			n = n + 1;
		} else {
			n = n;
		}
	}
	s = "正常範囲です。";
	if (n>=6)  s ="ストレス予備状態です。";
	if (n>=11) s ="ストレス状態です。（要注意）";
	if (n>=16) s ="ストレス病です。（要医療）";
	window.document.selfcheck.textfield.value = s; 
	return true;
}

function cls(){
	var i;
	for(i=0;i>=20;++i){
		gBl[i] = false;
		//document.forms[0].elements[i].value = false;
	}
} 

function btn(no){
	gBl[no] =! gBl[no];
//	document.forms[0].elements[i].value = gBl[no];
}


//StressQuiz A04
function ChkBoxCount_q04(){
	var s = "",i,n = 0;
	for(i=0;i<20;++i){
		if (gBl[i] == true){
			n = n + 1;
		} else {
			n = n;
		}
	}
	s = "正常範囲です。";
	if (n>=6) s ="年齢相応です。";
	if (n>=11) s ="精神疲労予備状態です。";
	if (n>=16) s ="精神疲労状態です。";
	document.selfcheck_q04.textfield.value = s;
	return true;
}

//StressQuiz A08

	var gBl_q08 = new MakeArrey(21*3);

function ChkBoxCount_q08(){

	var s = "",i,n = 0,p,e = 0;
	for(i=1;i<21;++i){
		if (gBl_q08[i] == 1) p = 4; 
		if (gBl_q08[i] == 2) p = 3; 
		if (gBl_q08[i] == 3) p = 2; 
		if (gBl_q08[i] == 4) p = 1;
		if (gBl_q08[i] == 0) e = 1;
		n = n + p;
	}
	s = "いまのところ安心。";
	if (n>=31) s ="心の病気に入りかけている人もいるので、用心すること。";
	if (n>=41) s ="要注意！うつ状態の予備軍。";
	if (n>=51) s ="ただちに専門医に。";
	if (e==1) s ="すべての項目をチェックしてください"
	document.selfcheck_q08.textfield.value = s;
	return true;
}

function cls_q08(){
	var i;
	for(i=0;i<20;++i){
		gBl_q08[i] = false;
		//document.forms[0].elements[i].value = false;
	}
}

function btn_q08(no,ans){
	gBl_q08[no] = ans;
	//document.forms[0].elements[i].value = gBl_q08[no];
}

//StressQuiz A09

function ChkBoxCount_q09(){
var s = "",i,n = 0,p,e = 0;
for(i=1;i<12;++i){
if (gBl[i] == 0) { e = 1; } else { n = n + gBl[i]; }
}
n = (n - 24) * 0.25;
s = "タイプA行動者ではありません。";
if (n>=50) s ="あなたはタイプA行動者です。";
if (e==1) s ="すべての項目をチェックしてください"
document.selfcheck_q09.textfield.value = s;
return true;
}

function btn_q09(no,ans){
	gBl[no] = ans;
	//document.forms[0].elements[i].value = gBl[no];
}


//StressQuiz A22

function ChkBoxCount_q22(){
	var s = "",i,n = 0;
	for(i=0;i<20;++i){
		if (gBl[i] == true){
			n = n + 1;
		} else {
			n = n;
		}
	}
	s = "正常です";
	if (n>=3) s ="要注意";
	if (n>=4) s ="アルコール中毒の危険性";
	document.selfcheck_q22.textfield.value = s;
	return true;
}

function cls_q22(){
	var i;
	for(i=0;i<20;++i){
		gBl[i] = false;
		//document.forms[0].elements[i].value = false;
	}
}


//骨粗鬆症******************************↓
//点滅処理↓↓↓↓↓　201012Ssaito
function tomoBlink()
	{
	if(document.all){
		if(document.all("ptbox").style.visibility == "visible"){
			document.all("ptbox").style.visibility = "hidden";
		}else{
			document.all("ptbox").style.visibility = "visible";
		}
	}else if(document.getElementById){
		if(document.getElementById("ptbox").style.visibility == "visible"){
			document.getElementById("ptbox").style.visibility = "hidden";
		}else{
			document.getElementById("ptbox").style.visibility = "visible";
		}
	}else{
		return;
	}
	setTimeout(tomoBlink, 500);
}
//点滅処理↑↑↑↑↑
//危険度アナウンス文言部↓

	theData   = "";
	theName   = "Age=";
	theData2  = "";
	box       = "Kg=";
	whoData   = "";
	who       = "Whobox=";
	theCookie = document.cookie+";";
	start     = theCookie.indexOf(theName);
	start2    = theCookie.indexOf(box);
	start3    = theCookie.indexOf(who);
	if (start != -1)
		{
			end      = theCookie.indexOf(";",start);
			end2     = theCookie.indexOf(";",start2);
			end3     = theCookie.indexOf(";",start3);
			theData  = unescape(theCookie.substring(start+theName.length,end));
			theData2 = unescape(theCookie.substring(start2+box.length,end2));
			whoData  = unescape(theCookie.substring(start3+who.length,end3));
		}

	switch(whoData)
		{
			case "1":{whoData="<p><strong>あなたの危険度はどうですか？</strong></p>";break;}
			case "2":{whoData="<p><strong>あなたのお母さんの危険度はどうですか？</strong></p>";break;}
		}

	x = theData2;
	y = theData;

	var kiken;
	var text_a;
	var text_b;
	var text_c;

	text_a="<strong>まずは一安心。</strong>";
	text_b="<strong>要注意です。骨量の測定をお勧めします。</strong>";
	text_c="<strong>危険です。早めの骨量測定をお勧めします。</strong>";

	if((y<=44)&&(x<=94)){kiken=text_a;}
	else if((y>=45)&&(y<=49)){if(x<=44){kiken=text_b;}else if((x>=45)&&(x<=94)){kiken=text_a;}}
	else if((y>=50)&&(y<=54)){if(x<=49){kiken=text_b;}else if((x>=50)&&(x<=94)){kiken=text_a;}}
	else if((y>=55)&&(y<=59)){if(x<=54){kiken=text_b;}else if((x>=55)&&(x<=94)){kiken=text_a;}}
	else if((y>=60)&&(y<=64)){if(x<=59){kiken=text_b;}else if((x>=60)&&(x<=94)){kiken=text_a;}}
	else if((y>=65)&&(y<=69)){if(x<=44){kiken=text_c;}else if((x>=45)&&(x<=64)){kiken=text_b;}else if(x>=65){kiken=text_a;}}
	else if((y>=70)&&(y<=74)){if(x<=49){kiken=text_c;}else if((x>=50)&&(x<=69)){kiken=text_b;}else if(x>=70){kiken=text_a;}}
	else if((y>=75)&&(y<=79)){if(x<=54){kiken=text_c;}else if((x>=55)&&(x<=74)){kiken=text_b;}else if(x>=75){kiken=text_a;}}
	else if((y>=80)&&(y<=84)){if(x<=59){kiken=text_c;}else if((x>=60)&&(x<=79)){kiken=text_b;}else if(x>=80){kiken=text_a;}}
	else if((y>=85)&&(y<=89)){if(x<=64){kiken=text_c;}else if((x>=65)&&(x<=84)){kiken=text_b;}else if(x>=85){kiken=text_a;}}
	else if((y>=90)&&(y<=94)){if(x<=69){kiken=text_c;}else if((x>=70)&&(x<=89)){kiken=text_b;}else if(x>=90){kiken=text_a;}}
	else if((y>=95)&&(y<=99)){if(x<=74){kiken=text_c;}else if(x>=75){kiken=text_b};}

//危険度アナウンス文言部↑
//ptbox移動↓↓↓↓↓　201012Ssaito
function mark()
{
	c =""
	x = theData2; //体重
	y = theData; //年齢
	var ysyoki = 29;	//ptbox初期位置Y
	var xsyoki = 47;	//ptbox初期位置X
	var yplus  = 20;	//ptbox移動距離Y
	var xplus  = 35;	//ptbox移動距離X

//	os      = navigator.userAgent.toUpperCase();
//	browser = navigator.appName.toUpperCase();

/////////////////// Win Start ///////////////////
	//年齢（top値）
	if(y<=44){y = ysyoki; c="#669977";}
	else if((y>=45)&&(y<=49)){y=ysyoki + yplus;if(x<=44){c="#FFCE4D";}else if(x>=45){c="#669977";}}
	else if((y>=50)&&(y<=54)){y=ysyoki + (yplus*2);if(x<=49){c="#FFCE4D";}else if(x>=50){c="#669977";}}
	else if((y>=55)&&(y<=59)){y=ysyoki + (yplus*3);if(x<=54){c="#FFCE4D";}else if(x>=55){c="#669977";}}
	else if((y>=60)&&(y<=64)){y=ysyoki + (yplus*4);if(x<=59){c="#FFCE4D";}else if(x>=60){c="#669977";}}
	else if((y>=65)&&(y<=69)){y=ysyoki + (yplus*5);if(x<=44){c="#D21B00";}else if((x>=45)&&(x<=64)){c="#FFCE4D";}else{c="#669977";}}
	else if((y>=70)&&(y<=74)){y=ysyoki + (yplus*6);if(x<=49){c="#D21B00";}else if((x>=50)&&(x<=69)){c="#FFCE4D";}else{c="#669977";}}
	else if((y>=75)&&(y<=79)){y=ysyoki + (yplus*7);if(x<=54){c="#D21B00";}else if((x>=55)&&(x<=74)){c="#FFCE4D";}else{c="#669977";}}
	else if((y>=80)&&(y<=84)){y=ysyoki + (yplus*8);if(x<=59){c="#D21B00";}else if((x>=60)&&(x<=79)){c="#FFCE4D";}else{c="#669977";}}
	else if((y>=85)&&(y<=89)){y=ysyoki + (yplus*9);if(x<=64){c="#D21B00";}else if((x>=65)&&(x<=84)){c="#FFCE4D";}else{c="#669977";}}
	else if((y>=90)&&(y<=94)){y=ysyoki + (yplus*10);if(x<=69){c="#D21B00";}else if((x>=70)&&(x<=89)){c="#FFCE4D";}else{c="#669977";}}
	else if((y>=95)&&(y<=99)){y=ysyoki + (yplus*11);if(x<=74){c="#D21B00";}else if(x>=75){c="#FFCE4D";}}
	//体重（left値）
	if(x<=44){x=xsyoki}
	else if((x>=45)&&(x<=49)){x=xsyoki + xplus;}
	else if((x>=50)&&(x<=54)){x=xsyoki + (xplus*2);}
	else if((x>=55)&&(x<=59)){x=xsyoki + (xplus*3);}
	else if((x>=60)&&(x<=64)){x=xsyoki + (xplus*4);}
	else if((x>=65)&&(x<=69)){x=xsyoki + (xplus*5);}
	else if((x>=70)&&(x<=74)){x=xsyoki + (xplus*6);}
	else if((x>=75)&&(x<=79)){x=xsyoki + (xplus*7);}
	else if((x>=80)&&(x<=84)){x=xsyoki + (xplus*8);}
	else if((x>=85)&&(x<=89)){x=xsyoki + (xplus*9);}
	else if((x>=90)&&(x<=94)){x=xsyoki + (xplus*10);}

	if (document.all)    {
		document.all("ptbox").style.background = c;
		document.all("ptbox").style.left       = x +"px";
		document.all("ptbox").style.top        = y +"px";
	}
	if (document.layers) {
		document.layers["ptbox"].background = c;
		document.layers["ptbox"].left       = x +"px";
		document.layers["ptbox"].top        = y +"px";
	}
	if (!document.all && document.getElementById) {
		document.getElementById("ptbox").style.background = c;
		document.getElementById("ptbox").style.left       = x +"px";
		document.getElementById("ptbox").style.top        = y +"px";
	}
}
//ptbox移動↑↑↑↑↑
//骨粗鬆症******************************↑

function sb_saveCookie(name,cvalue,days) {
        if (days) {
            var date = new Date();
            date.setTime(date.getTime()+(days*24*60*60*1000))
            var expires = "; expires="+date.toGMTString()
        }
        else expires = ""
        document.cookie = name+"="+cvalue+expires+"; path=/"
}   

    // Returns the entire query string passed to the current page.
    function getQueryString(){ 
            zquery = parent.location.search; 
            zquery = zquery.substring(1,zquery.length); 
            return (zquery); 
    } 

    // Parses a query string 'queryString' for the variable 'queryName'
    // and returns the value associated with that name.
    function parseQuery (queryString, queryName) {
            startIndex = queryString.indexOf(queryName);
            if (startIndex == -1) {
                    return "";
            }

            startIndex = queryString.indexOf("=", startIndex) + 1;
            endIndex = queryString.indexOf("&", startIndex);
            if (endIndex == -1) {
                    endIndex = queryString.length;
            }
            return queryString.substring(startIndex, endIndex);
    }

    function save_requested_url(){
        //alert(parseQuery(getQueryString(), 'request_url'));
        var requestUrl = parseQuery(getQueryString(), 'request_url');
        if( requestUrl != ''){
            sb_saveCookie( 'request_url', requestUrl);
        }
    }

function getCookieVal (offset) 
{  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
	endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) 
{  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) 
	{    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
			return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}

