<div class="content_title"><a href="/master/domains">Domeny</a> > wykresy pozycji w google</div>
<div>
    <div style="float:left;"><?php $this->load->view('admin/switch_domain');?></div>
    <?php $domain_id = (int)$this->uri->segment(3); ?>
    <div style="float:right;">
        <a title="pozycje w google" href="/master/domain_positions/<?php echo $domain_id; ?>" class="gray_link">
            <img alt="pozycje w google" src="/files/opcja1.gif">
        </a>&nbsp;
        <a title="wykresy pozycji w google" href="/master/domain_positions_charts/<?php echo $domain_id; ?>" class="gray_link">
            <img alt="wykresy pozycji w google" src="/files/opcja2.gif">
        </a>
        <a title="statystyki odsłon strony" href="/master/domain_visits_charts/<?php echo $domain_id; ?>" class="gray_link">
            <img alt="statystyki odsłon strony" src="/files/opcja3.gif">
        </a>
        <a title="szczegółowe statystyki odsłon strony" href="/master/domain_visits/<?php echo $domain_id; ?>" class="gray_link">
            <img alt="szczegółowe statystyki odsłon strony" src="/files/opcja4.gif">
        </a>
    </div>
</div>
<br class="clear"/>
	<?php

		$type = $this->uri->segment(4);
		if ($type==null)
		{
			$type=1;
		}
	?>
	
		<div class="mediumButton"><a class="gray_link" <?php if($type==1) echo 'style="color:#ec2323"'; ?> href="/master/domain_positions_charts/<?php echo $domain_id; ?>/1">dzienne</a></div>
		<div class="mediumButton"><a class="gray_link" <?php if($type==2) echo 'style="color:#ec2323"'; ?> href="/master/domain_positions_charts/<?php echo $domain_id; ?>/2">tygodniowe</a></div>
		<div class="mediumButton"><a class="gray_link" <?php if($type==3) echo 'style="color:#ec2323"'; ?> href="/master/domain_positions_charts/<?php echo $domain_id; ?>/3">miesięczne</a></div>
		<div class="mediumButton"><a class="gray_link" <?php if($type==4) echo 'style="color:#ec2323"'; ?> href="/master/domain_positions_charts/<?php echo $domain_id; ?>/4">kwartalne</a></div>
		<div class="mediumButton"><a class="gray_link" <?php if($type==5) echo 'style="color:#ec2323"'; ?> href="/master/domain_positions_charts/<?php echo $domain_id; ?>/5">roczne</a></div>
        <br /><br /><br />
	<?php
		
                        switch($type)
						{
						case 1: {
						    			// "Dzienne"; 
									//echo '<img src="/charts/chart_line/'.$domain_id.'" />';
                                                                                echo '<input type="hidden" value="'.base_url().'charts/flash_chart_line/'.$domain_id.'" id="chart_url"/>';
                                                                                
                                                                                echo 'Data końca: <input id="daily_max_date"    name="date" type="text" class="datepicker" value=""/>&nbsp;&nbsp;';
                                                                                echo 'Liczba dni: <input id="daily_days"        name="days" type="text" value=""/>&nbsp;&nbsp;';
                                                                                echo '<button type="button" id="daily_stats_submit" class="grey_button round_corners">Zatwierdź</button> ';
                                                                                echo '<br style="clear:both" />';
                                                                                
 										echo '<div id="my_chart" >charts/flash_chart_line/'.$domain_id.'</div>';
										break;
									}
						case 2: {
						    			// "tygodniowe"; 
										//echo '<img src="/charts/chart_line_weekly/'.$domain_id.'" />';
										echo '<div id="my_chart">charts/flash_chart_line_weekly/'.$domain_id.'</div>';
										break;
									}
						case 3: {
						    			// "miesieczne"; 
										//echo '<img src="/charts/chart_line_monthly/'.$domain_id.'" />';	
										echo '<div id="my_chart">charts/flash_chart_line_monthly/'.$domain_id.'</div>';							
										break;
									}
						case 4: {
						   			// "kwartalne"; 
									//echo '<img src="/charts/chart_line_quartely/'.$domain_id.'" />';
									echo '<div id="my_chart">charts/flash_chart_line_quartely/'.$domain_id.'</div>';								
									break;
								}
						
						case 5: {
			    			// "roczne"; 
							//echo '<img src="/charts/chart_line_yearly/'.$domain_id.'" />';
							echo '<div id="my_chart">charts/flash_chart_line_yearly/'.$domain_id.'</div>';		
							break;
						}						
	}
	?>
	
	<br /><br />
	<div>
	<?php 	
		
		
		$i=0;
		//var_dump($keywords);
		//die;
		foreach($keywords as $keyword)
		{
		//echo $keyword['keyword']."<br>";
		
			$querystring = 'search?q='.str_replace(' ','+',urlencode($keyword['keyword'])).'&num=10';
			echo '<div style="float:left;text-align:left;width:32px; height:14px; background-color:'.$colors[$i].'">&nbsp;</div>';
			echo '<div style="float:left;"> &nbsp;&nbsp;&nbsp; <a href="http://google.'.$google_region.'/'.$querystring.'" target="_blank">'.$keyword['keyword'].'</a></div>';
			echo '<br style="clear:both"/><br />';
			$i++;
		}
	?>
			<div style="float:left;text-align:left;width:32px; height:14px; background-color:#ffffff">PZ</div>
			<div style="float:left;"> &nbsp;&nbsp;&nbsp; poza zakresem</div>
	</div>	
	<br style="clear:both"/><br />
        <div class="form_buttons_v1">
            <input type="button" name="wstecz" value="Wstecz" class="formButton" onClick="document.location.href='<?php echo base_url();?>master/domains';"/>
        </div>

<script type="text/javascript">
	//skrypty do wykresów flashowych
	function ofc_ready()
	{
	   // alert('ofc_ready');
	}
	var data = null;
	
	function open_flash_chart_data()
	{
	    //alert( 'reading data' );
	    return JSON.stringify(data);
	}
	
	function findSWF(movieName) {
	  if (navigator.appName.indexOf("Microsoft")!= -1) {
	    return window[movieName];
	  } else {
	    return document[movieName];
	  }
	}
		
      $(document).ready(function() {

                $("#daily_stats_submit").click(function(){
                    var days     = $("#daily_days").val();
                    var max_date = $("#daily_max_date").val();

                    if(days<=0 || days > 60)
                    {
                        alert('Pole Liczba dni posiada nieprawidłową wartość');
                        return;
                    }
                    if(max_date == "")
                    {
                        alert('Pole Data końca posiada nieprawidłową wartość');
                        return;
                    }

                    var url = $("#chart_url").val()+'/'+max_date+'/'+days;
                    
                    $.getJSON(url,
		        function(param){
			    data = param;
                            swfobject.embedSWF("/files/open-flash-chart.swf", "my_chart", "595", "400", "9.0.0");
		    });
                    return;
                });

		$(".datepicker").datepicker({
                     dateFormat: 'yy/mm/dd',
                     separator: '/',
                     showAnim: '',
                     maxDate: new Date()
                });
	  	
		var url = "<?php echo base_url(); ?>" +$("#my_chart").text();	 
		$.getJSON(url,
		        function(param){
			    data = param;
                            
                            var params = {
                                    quality: "high",
                                    scale: "noscale",
                                    wmode: "opaque",
                                    allowscriptaccess: "always"
                            };
                            var flashvars = {};
                            var attributes = {id:"my_chart"};

                            swfobject.embedSWF("/files/open-flash-chart.swf", "my_chart", "595", "400", "9.0.0","expressInstall.swf",flashvars, params, attributes);
		        });			 
	         		
      });
	  //end of skrypty do wykresów flashowych
</script>	