/***
sright.js
note: please don't remove commented codes some of them are part of the process
***/




$(document).ready(function() {
						   
						   
	var name = "#slideinbutton";
	var menuYloc = null;

	
		menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
			$(window).scroll(function () { 
				offset = menuYloc+$(document).scrollTop()+"px";
				$(name).animate({top:offset},{duration:500,queue:false});
			});
					   
					  
						   
						   

	$('.inner').css({'padding': '0px'});

	var forwidth  = 366;  // width for the left and right slides
	var forheight  = 590; // height for the left and right slides
	

	
	
	
	var forwidth  = $(".inner").width();
	if(forwidth < 340){  forwidth = 340; }
	var forheight  = $(".inner").height();	
	if($.browser.safari){
	 forheight =  forheight + 55;
	}
	//var marwidth = ( docwidth - forwidth ) / 2;
	
	
	
		
	if($.browser.safari){
	 forwidth =  forwidth;
	}
	
	

	
	var check = ''; 
	
	if(check == false || check == ''){
		
	//setCookie('slideinpopup','yes',365);
	
	

	

	$('.slide').css({'display': 'none'});
	
	
	$('.slide').css({'right': '0px'});
	$('.slide').css({'height':'100%'});
	$('.slide').css({'width':  forwidth + 'px'});
	$('.inner').css({'right': '-' + forwidth  + 'px'});
	$('.inner').css({'height': '100%'});
	$('.inner').css({'width':  forwidth + 'px'});
	$('#slideinbutton').css({'right': 0 });	
	$("form").attr('target', '_self');
	$('.slide').css({'position': 'fixed'});



	$('#slideinbutton').css({'display': 'block'});
		
	/**autopop
	$('.slide').css({'display': 'block'});
	$('#slideinbutton').css({'visibility': 'hidden'}); 	
	$('.inner').delay(3000).animate({ right: "0px"},3000);
	//$('.inner').css({'position': 'fixed'});
	autopop**/
	
	

	
	$('#slideinbutton').click(function() {
		$('.slide').css({'display': 'block'});	
		$('#slideinbutton').css({'visibility': 'hidden'}); 	
		$('.inner').animate({ right: "0px"},3000);
		$("form").attr('target', '_blank');
    }); 
	
	

 	$('#back').click(function() {
			
			$('.inner').animate({ right: '-' + forwidth + "px"},3000, 
					function(){ 
					$('.slide').css({'display': 'none'}); 
					$('#slideinbutton').css({'visibility': 'visible'});	
					$("form").attr('target', '_self');
					});								 
  			
  }); 
	
	
	$('#optsubmit').click(function() {
			
			$('.inner').animate({ right: '-' + forwidth + "px"},3000, 
				function(){ 
				
				$('.slide').css({'display': 'none'});
				$('#slideinbutton').css({'visibility': 'visible'});
				$("form").attr('target', '_self');
				
				});								 
  			
  }); 
	
	
	
	   $("form").submit(function() {
							 
			
			$('.inner').animate({ right:  '-' +  forwidth + "px"},3000, 
				function(){ 
					 $('.slide').css({'display': 'none'});
					 $('#slideinbutton').css({'visibility': 'visible'});
					 $("form").attr('target', '_self');
					

					 
				});	

  
    });
	
	
	
  }
  
  
  
  
  
  //cookie check function
  
  
  
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function checkCookie()
{
slideinpopup=getCookie('slideinpopup');
if (slideinpopup!=null && slideinpopup!="")
  {
  	return true;
  }
else
  {
   
   return false;
  
  }
}



});
