// JavaScript Document

// Author: Andrei Dumitru Zona-AdStudio.ro

function set_event( day, month, year, tevent, anchor_id ) {
	
	has_event = 1;
	
	
	
	//alert( day +' '+ month +' '+ year +' '+ tevent +' '+ anchor_id   );
	
	if ( has_event == 1 ) {
		
		//document.getElementById('pinpoint').style.display = 'block';
		/*
		if ( navigator.userAgent.search("MSIE 7") != '-1' ) { // if IE 7
		
			document.getElementById('pinpoint').style.display = 'block';

		} else if ( navigator.userAgent.search("MSIE 8") != '-1' ) { // if IE 8
		
			document.getElementById('pinpoint').style.display = 'block';
		
		} else if ( navigator.userAgent.search("MSIE 9") != '-1' ) { // if IE 9 
		
			//$('#pinpoint').fadeIn(200);
			
			document.getElementById('pinpoint').style.display = 'block';
		
		} else { // if else
		
			//$('#pinpoint').fadeIn(200);
			
			document.getElementById('pinpoint').style.display = 'block';
		
		} */
		
		
		document.getElementById('pinpoint').style.display = 'block';
		
		//$('#pinpoint').fadeIn(500);
		
		//alert( document.getElementById('pinpoint').style.display );
		
		//$('#pinpoint').fadeIn(200);
		
		//alert(day +' '+ month +' '+ year);
		
		pinpoint_weight = '280';
		
		anchor_y = document.getElementById(anchor_id).offsetTop ;
		
		anchor_x = document.getElementById(anchor_id).offsetLeft ;
		
		document.getElementById('pinpoint').style.width = pinpoint_weight + 'px';
		
		document.getElementById('pinpoint').style.display = 'block';	
		
		document.getElementById('pinpoint_container').innerHTML = tevent;
		
		//document.getElementById('pinpoint_container').innerHTML = eventlist_array[day+month+year];
		
		//document.getElementById('pinpoint_container').innerHTML = document.getElementById('pinpoint_container').innerHTML + day + ' ' + month + ' ' + year + ' - ' + anchor_id + '<br>';
		
		//document.getElementById('pinpoint_container').innerHTML = document.getElementById('pinpoint_container').innerHTML + day + ' ' + month + ' ' + year + ' - ' + anchor_id + '<br>';
		
		//document.getElementById('pinpoint_container').innerHTML = document.getElementById('pinpoint_container').innerHTML + day + ' ' + month + ' ' + year + ' - ' + anchor_id + '<br>';
		
		//document.getElementById('pinpoint_container').innerHTML = document.getElementById('pinpoint_container').innerHTML + day + ' ' + month + ' ' + year + ' - ' + anchor_id + '<br>';
		
		//document.getElementById('pinpoint_container').innerHTML = document.getElementById('pinpoint_container').innerHTML + '<br/>sdffsdfsdfsfsdfsf<br/>' + anchor_x + '<br/>' + anchor_y + '<br />';
		
		///////////////////////////////////////////////////////
		
		pinpoint_height_input = document.getElementById('pinpoint').clientHeight;
		
		/*if ( pinpoint_height_input > 300 ) {
		
			document.getElementById('pinpoint_container').setAttribute('style', 'height: 300px; overflow: auto');
			
			//document.getElementById('pinpoint_container').style.overflow = 'auto';
			
			//document.getElementById('pinpoint_container').style.overflowX = 'hidden';
			
			document.getElementById('pinpoint_container').focus();
			
		} else {
			
			document.getElementById('pinpoint_container').setAttribute('style', '');
			
		}*/
		
		
		//document.getElementById('testbox').value = document.getElementById('pinpoint').clientHeight;
		
		//alert(pinpoint_height_input);
		
		if ( navigator.userAgent.search("MSIE 7") != '-1' ) { // if IE 7
		
			pinpoint_height = pinpoint_height_input + 4;
			
			constant_height = -5;

		} else if ( navigator.userAgent.search("MSIE 8") != '-1' ) { // if IE 8
		
			pinpoint_height = pinpoint_height_input + 4;
			
			constant_height = -5;
		
		} else if ( navigator.userAgent.search("MSIE 9") != '-1' ) { // if IE 9 
		
			pinpoint_height = pinpoint_height_input + 6;
			
			constant_height = -5;
		
		} else { // if else
		
			pinpoint_height = pinpoint_height_input;
			
			constant_height = -5;
		
		} 
		
		//pinpoint_height = pinpoint_height_input;
		
		//constant_height = 130;
		
		
		
		//document.getElementById('pinpoint_container').innerHTML = document.getElementById('pinpoint_container').innerHTML + pinpoint_height;
		
		aling_vertical = -pinpoint_height -constant_height + anchor_y  + 'px';
		
		document.getElementById('pinpoint').style.top =  aling_vertical;
		
		//document.getElementById('testbox2').value = aling_vertical;
		
		
		
		document.getElementById('pinpoint').style.left =  ( -( pinpoint_weight / 2 ) + 20 + anchor_x  ) + 'px';

	
		
		
	} else {}
	
		
	
	
}

function unset_event() {
	
	document.getElementById('pinpoint').style.display = 'none';	
	
	//$('#pinpoint').fadeOut(300);


}

function open_popup() {
	
	var msie=new RegExp("MSIE"); 
	
	if ( msie.test(navigator.userAgent) ) {
		
		document.getElementById('dark_mask').style.display = 'block';
		
	} else {
		
		$('#dark_mask').fadeIn(500);
		
	}
	
	//$('#dark_mask').fadeIn(500);
	
	setTimeout("$('#pop_cal_holder').fadeIn(500);",700);

	
	popup_calendar( 'month', '', pop_day, pop_month, pop_year );
	
	//document.getElementById('pop_cal_holder').style.display = 'block';
	
}


function close_popup() {

	//document.getElementById('dark_mask').style.display = 'none';
	
	//document.getElementById('pop_cal_holder').style.display = 'none';
	
	document.getElementById('mini_cal_popup').innerHTML = '';
	
	var msie=new RegExp("MSIE"); 
	
	if ( msie.test(navigator.userAgent) ) {
		
		document.getElementById('pop_cal_holder').style.display = 'none';
		document.getElementById('dark_mask').style.display = 'none';
		
	} else {
		
		$('#pop_cal_holder').fadeOut(500);
		setTimeout("$('#dark_mask').fadeOut(500);",700);
		
	}
	
	
	setTimeout("open_calendar(main_cal_month, main_cal_year);", 500);
	
	//$('#dark_mask').fadeIn(500);
	
	
	
}

