
//============================================================================================================================
$(window)
.resize(function(){
  cssSetting();
})
.load(function(){

colorfulStage();

if(self.location.href==top.location.href){
	/**/
}else{
mimikoAjax();
};

cssSetting();

});


function mimikoAjax(){
//alert(tabId);
$('a')
.one('blur',function(){
			   if( $(this).attr('href') && $(this).attr('href').length>6 ){
				   if( $(this).attr('href').search(/sisituan|127\.0\.0\.1/)!=-1 ){
					   $(this)
					   .attr( 'target', '_self' )
					   .attr( 'mimikoHref', function(){ return this.href; })
					   .removeAttr( 'href' )
					   .addClass( 'mimikoHref' );
				   }else{
					   if( $(this).attr('href').search(/\:/)==-1 ){
						   $(this)
						   .attr( 'target', '_self' )
						   .attr( 'mimikoHref', function(){ return this.href; })
						   .removeAttr( 'href' )
						   .addClass( 'mimikoHref' );
					   }else{
						   $(this)
						   .attr( 'target', '_blank' )
						   .attr( 'mimikoHref', function(){ return this.href; })
						   .removeAttr( 'href' )
						   .addClass( 'mimikoHref' );
					   };
				   };
			   }else{};
			   })
.blur()
.mousedown(function(mimikoMouseClickState){
				if( $(this).attr('mimikoHref') && $(this).attr('mimikoHref').length>6 ){
					if( $(this).attr('target')!='_blank'){
						if( $(this).attr('mimikoHref').search(/maid.php/)!=-1 ){
							top.location.href=$(this).attr('mimikoHref');
						}else{
							if( mimikoMouseClickState.which==1 ){
								parent.tabLoadin( $(this).attr('mimikoHref') );
								return false;
							}else if( mimikoMouseClickState.which==2 ){
								window.open( $(this).attr('mimikoHref') );
								return false;
							}else if( mimikoMouseClickState.which==3 ){
								parent.openNewTab( $(this).attr('mimikoHref') );
								return false;
							};
						};
					}else{
						window.open( $(this).attr('mimikoHref') );
					};
				};
											 })
.bind("contextmenu", function(){
							  return false;
							  });
};

function cssSetting(){
	$('#bodyCan, #noise')
	.css({ width:window.innerWidth, height:window.innerHeight });
	
	$('#speedDial')
	.css({ width:window.innerWidth*0.9, height:window.innerHeight*0.8, left:window.innerWidth*0.05, top:window.innerHeight*0.1 });
	
	$('#speedDialTitle')
	.css({ height:window.innerHeight*0.8*0.1, 'line-height':window.innerHeight*0.8*0.1+'px', 'font-size':window.innerHeight*0.8*0.1*0.6 });
	
};

function colorfulStage(){

setTimeout("$('.sePlayer').media({ width:0, height:0, autoplay:true, src:'index/audio/speeddial/fade.wma', params:{PlayCount:1} });",1000);

$('#bodyCan')
.css({'background-image':'url(index/image/bg/bg-'+parseInt( 237*Math.random(), 10 )+'.jpg)'});

$("#speedDial").easydrag();
$("#speedDial").setHandler("speedDialTitle");

$('#speedDialTitle')
.mousedown(function(){
					$('.sePlayer').media({ width:0, height:0, autoplay:true, src:'index/audio/speeddial/dragdown.wma', params:{PlayCount:1} });
					
					$('#speedDialMainArea')
					.hide();
					
					$('#speedDial')
					.css({
						 'box-shadow':'0 0 0 rgba(0,0,0,0)',
						 '-moz-box-shadow':'0 0 0 rgba(0,0,0,0)',
						 '-webkit-border-shadow':'0 0 0 rgba(0,0,0,0)',
						 
						 'border-radius':'0',
						 '-moz-border-radius':'0',
						 '-webkit-border-radius':'0',
						 
						 background:'rgba(0,0,0,0.2)'
						 });
					
					$('#speedDialTitle')
					.html('');
					
					//return false;
					})
.mouseup(function(){
				  $('.sePlayer').media({ width:0, height:0, autoplay:true, src:'index/audio/speeddial/dragup.wma', params:{PlayCount:1} });
				  
				  $('#speedDialMainArea')
				  .show();
				  
				  $('#speedDial')
					.css({
						 'box-shadow':'0 0 2px rgba(255,255,255,1),0 0 4px rgba(0,0,0,0.5),0 4px 8px rgba(0,0,0,0.5)',
						 '-moz-box-shadow':'0 0 2px rgba(255,255,255,1),0 0 4px rgba(0,0,0,0.5),0 4px 8px rgba(0,0,0,0.5)',
						 '-webkit-border-shadow':'0 0 2px rgba(255,255,255,1),0 0 4px rgba(0,0,0,0.5),0 4px 8px rgba(0,0,0,0.5)',
						 
						 'border-radius':'16px',
						 '-moz-border-radius':'16px',
						 '-webkit-border-radius':'16px',
						 
						 background:'rgba(0,0,0,0.5) url(index/image/backhighlight.png) center center repeat-y'
						 });
					
				  $('#speedDialTitle')
					.html('- 快速拨号 -');
					
				  //return false;				  
				  });

$('.card')
.one('blur',function(){
					 $(this)
					 .css({ 'background-image':'url(index/image/speeddial/'+parseInt( 18*Math.random(), 10 )+'.jpg)' })
					 .animate({opacity:0}, parseInt( 1000+4000*Math.random(), 10 ) )
					 .animate({opacity:1},500);
					 })
.blur();
};