jQuery.fn.blindToggle = function(speed, easing, callback) {
  var h = this.height() + parseInt(this.css('paddingTop')) + parseInt(this.css('paddingBottom'));
  return this.animate({marginTop: parseInt(this.css('marginTop')) < 0 ? 0 : -h}, speed, easing, callback);  
};
var offen = false;
var JQ = jQuery.noConflict();

  function contact_me(){
	  JQ("#ajax_content").load('/company/kontakt/3d-brille-bestellen/?cache=true',
	  function() {
						JQ.blockUI({ 
							theme:     true, // true to enable jQuery UI support 
							draggable: false, // draggable option is only supported when jquery UI script is included 
							title: null,
							message:  JQ("#ajax_content"),
							css: { 
								top:  (JQ(window).height() - 356) /2 + 'px', 
								left: (JQ(window).width() - 990) /2 + 'px', 
								width: '990px',
								height: '356px',
								cursor:'default'
							} ,
							themedCSS: {
								width:	'990px',
								height:	'356px',
								top:	(JQ(window).height() - 356) /2 + 'px',
								left:	(JQ(window).width() - 990) /2 + 'px'
							},
	
							overlayCSS: { backgroundColor: '#000000', cursor:'default' }
						});
					JQ('.blockOverlay').click(JQ.unblockUI);
					
					
					try {
						JQ('div.wpcf7 > form').ajaxForm({
							beforeSubmit: wpcf7BeforeSubmit,
							dataType: 'json',
							success: wpcf7ProcessJson
						});
					} catch (e) {
					}
				
					try {
						JQ('div.wpcf7 > form').each(function(i, n) {
							wpcf7ToggleSubmit(jQuery(n));
						});
					} catch (e) {
					}
				
					try {
						if (_wpcf7.cached) {
							JQ('div.wpcf7 > form').each(function(i, n) {
								wpcf7OnloadRefill(n);
							});
						}
					} catch (e) {
					}					
					
					//alert(JQ('div.wpcf7 > form').text());
		}
	);	  
	  
	  


					
					
	  
	  
	  }
  


  function hotspot(url){
	  JQ("#ajax_content").empty();
	  if(url!=""){
	  var cache = new Date().getTime();
	  JQ("#ajax_content").load(url+'?cache='+cache);
/*	 JQ("#ajax_content").dialog({
			height: 660,
			width: 990,
			modal: true
			});*/

	  					JQ.blockUI({ 
							theme:     true, // true to enable jQuery UI support 
							draggable: false, // draggable option is only supported when jquery UI script is included 
							title: null,
							message:  JQ("#ajax_content"),
							css: { 
								top:  (JQ(window).height() - 660) /2 + 'px', 
								left: (JQ(window).width() - 990) /2 + 'px', 
								width: '990px',
								height: '660px',
								cursor:'default'
							} ,
							themedCSS: {
								width:	'990px',
								height:	'660px',
								top:	(JQ(window).height() - 660) /2 + 'px',
								left:	(JQ(window).width() - 990) /2 + 'px'
							},
	
							overlayCSS: { backgroundColor: '#000000', cursor:'default' }
						});
					JQ('.blockOverlay').click(JQ.unblockUI);
	  }
	  else{
		  return;
		  }

}


			function activate3DButton()
			{
				//alert("activate 3D button");
				JQ('#flash_3d').addClass("active");
				JQ.cookie("version", "3d");
			}
			
			function activateNormalButton()
			{
				//alert("activate normal button");
				JQ('#flash_normal').addClass("active");
				JQ.cookie("version", "normal");
			}
		
			function openOrderForm()
			{
				//alert("OrderForm!");
					  JQ("#ajax_content").empty();
					  JQ("#ajax_content").text('');
					  contact_me();
			}
			
			function openLightBox(url)
			{
				//alert("LightBox: "+url);
				
				hotspot(url);
			}


JQ(document).ready(function(){
							
		//JQ('#footer_copy').bind('click', function() {
										  
			//	contact_me();							   
		//});
		JQ("a[href^='https://']").attr('target', '_blank');
		var flashwidth = 1248;	
		var flashheight = 522;
		var version = "menu";
		if(JQ.cookie("version")){
			version = JQ.cookie("version");
			JQ("#flash_"+version).addClass("active");
			}
			else{
				version = "menu"
				}
		
		
		var flash_player = 'http://'+location.hostname+'/wp-content/themes/mediaworld/flash/swf/panorama.swf';
		if(JQ(window).width() <=1200){
			flashwidth = 1000;
			flashheight = 420;
			JQ('#flash_slider').height(420);
		    flash_player = 'http://'+location.hostname+'/wp-content/themes/mediaworld/flash/swf/panorama_small.swf';
			}								   
											   
		JQ('#flash_3d').bind('click', function() {
			JQ.cookie("version", "3d");
			JQ('#flash_slider').empty();
			JQ('#flash_normal').removeClass("active"); 
			JQ(this).addClass("active");
				JQ('#flash_slider').flash({
					expressInstall: true ,
					version: "10.0.22.0",
					update: true,
					swf: flash_player,
					width: flashwidth,
					height: flashheight,
					play: true,
					wmode:'transparent',
					flashvars: { host: 'http://'+location.hostname+'/wp-content/themes/mediaworld/flash/', theme_data: 'http://'+location.hostname+'/wp-content/themes/mediaworld/flash/xml/theme_data.xml', init_view : '3d' },
				
					id:"pattern_generator",
					name:"pattern_generator"
				});							

		});
		
		JQ('#flash_normal').bind('click', function() {
			JQ.cookie("version", "normal");
			JQ('#flash_slider').empty();
			   JQ('#flash_3d').removeClass("active"); 
			    JQ(this).addClass("active"); 
				JQ('#flash_slider').flash({
					expressInstall: true ,
					version: "10.0.22.0",
					update: true,
					swf: flash_player,
					width: flashwidth,
					height: flashheight,
					play: true,
					wmode:'transparent',
					flashvars: { host: 'http://'+location.hostname+'/wp-content/themes/mediaworld/flash/', theme_data: 'http://'+location.hostname+'/wp-content/themes/mediaworld/flash/xml/theme_data.xml', init_view : 'normal' },
				
					id:"pattern_generator",
					name:"pattern_generator"
				});							

		});

							

		JQ('#flash_slider').flash({
			expressInstall: true ,
			version: "10.0.22.0",
			swf: flash_player,
			width: flashwidth,
			height: flashheight,
			play: true,
			wmode:'transparent',
			flashvars: { host: 'http://'+location.hostname+'/wp-content/themes/mediaworld/flash/', theme_data: 'http://'+location.hostname+'/wp-content/themes/mediaworld/flash/xml/theme_data.xml', init_view : version+'' },
		
			id:"pattern_generator",
			name:"pattern_generator"
		});							



							
  var box = JQ('#box').wrap('<div id="box-outer"></div>');
  JQ('#top_menue').click(function() {
		box.blindToggle('slow');
  });  
  JQ('#blind').click(function() {
		box.blindToggle('slow');
  });  

  JQ('#unsere_leistungenn').click(function() {
 var message_to_show = "<div style='padding:0 10px;' id='leistungen_content'><h2 style='text-align: center; font-size: 190%;'>Unsere Leistung</h2><p><strong>Das D+S 360° Team ist seiner <a href='/company/mission/'>Mission</a> verpflichtet</strong></p><p>Die 360° media world ist ein Full Service Outsourcing Dienstleister der <a href='/company/ds-konzern/'>D+S Gruppe</a> für Customer Care, der neben dem klassischen Telefonkanal auch <a href='/services/media-consulting/'>Webservices</a> abdeckt.</p><p>Von der Beratung zur Analyse. Von der Analyse zur Konzeption. Von der Konzeption zum Betrieb.</p><p>Wir gestalten Ihre Kommunikationslösung so, dass die Anliegen Ihrer Kunden schnellst möglich gelöst werden. Dabei beraten wir Sie auch, wie Sie noch besser eine hervorragende <a href='/services/customer-experience/'>„Customer Experience“</a> off- und online realisieren können und beziehen natürlich Marketing und Vertrieb in die Betrachtung mit ein. Wir realisieren reine Call-Projekte oder Onlineprojekte und die intelligente Kombination beider.</p><p>Das ist es, was wir unter unserem 360° Kommunikationsansatz verstehen.</p><p><a style='display: block; text-align: center;' href='/company/ds_360grad_team/'><img width='300' height='292' src='/wp-content/uploads/2010/10/gap_analyse.gif' title='Unsere Leistung im Detail'></a></p></div>";

					JQ.blockUI({ 
							theme:     true, // true to enable jQuery UI support 
							draggable: false, // draggable option is only supported when jquery UI script is included 
							title: null,
							message:  message_to_show,
							css: { 
								top:  (JQ(window).height() - 600) /2 + 'px', 
								left: (JQ(window).width() - 650) /2 + 'px', 
								width: '650px',
								height: '600px',
								cursor:'default'
							} ,
							themedCSS: {
								width:	'650px',
								height:	'600px',
								top:	(JQ(window).height() - 600) /2 + 'px',
								left:	(JQ(window).width() - 650) /2 + 'px'
							},
	
							overlayCSS: { backgroundColor: '#000000', cursor:'default' }
						});
					JQ('.blockOverlay').click(JQ.unblockUI);


  });
  
    JQ('#unsere_leistungen').click(function() {
											
		var url = "/ds-cc/leistungen/";
		
		  JQ("#ajax_content").empty();
		  if(url!=""){
			  //JQ("#ajax_content").prepend("<div class='left_column'></div>");
		  JQ("#ajax_content").load('/ds-cc/leistungen/ .left_column', function(){JQ("#ajax_content div.contact_details").empty();JQ("#ajax_content p").attr('style','margin:10px 0px');JQ("#ajax_content").attr('style','font-size:12px;line-height:14px; padding:0 10px')});
		   
							JQ.blockUI({ 
								theme:     true, // true to enable jQuery UI support 
								draggable: false, // draggable option is only supported when jquery UI script is included 
								title: null,
								message:  JQ("#ajax_content"),
								css: { 
								top:	(JQ(window).height() - 600) /2 + 'px',
								left:	(JQ(window).width() - 650) /2 + 'px',
								width:	'650px',
								height:	'600px',
									cursor:'default'
								} ,
								themedCSS: {
								width:	'650px',
								height:	'600px',
								top:	(JQ(window).height() - 600) /2 + 'px',
								left:	(JQ(window).width() - 650) /2 + 'px'
								},
		
								overlayCSS: { backgroundColor: '#000000', cursor:'default' }
							});
						JQ('.blockOverlay').click(JQ.unblockUI);
		  }
		  else{
			  return;
		  }


		
		
	});
  
});
