function initializeGMap() {
    var latlng = new google.maps.LatLng(49.190886,16.622304);
    var myOptions = {
		zoom: 16,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("gMap"), myOptions);

	var marker = new google.maps.Marker({
		position: latlng, 
		map: map, 
		title:"SOVA NET"
  	});
}

$(document).ready(function(){	
	// selectbox
	$('.right div.form select').sSelect();
	//$('#mezinarodni-marketing-formular select').sSelect();
	// $('#mailform-select').sSelect();
	
	// scrolovani z5 nahoru po nahrazeni selectu
	// scroll(0,0); -odstraneno nahrazovani selectu
	
	// tabs
	//$("ul.tabs").tabs("div.panes > div");

	// reset input
	$(".reset-input").focus(function() {
		$(this).val('');
	});
	
	// cufon
	/*Cufon.set('selector', jQuery);
	Cufon.replace('.cufon h1');
	Cufon.replace('.cufon h2');
	Cufon.replace('.cufon h3');
	Cufon.replace('.cufon strong.title', {hover: true});*/
	
	//map
	if ($('body').attr("id") == "kontakt" || $('body').attr("id") == "contacts") {
		//getMap(49.190886,16.622304,"S","Sovanet","gMap");
     	initializeGMap();
	}
	
	// form v paticce
	$('#mailform-button').click(function(){
		
		$mail = $('input#email_2').val();
		$text = $('textarea#mailform-input').val();
		
		var Ch = {
		  objRegExp : {
		    'email' : /^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$/i,
		  	'text' : /^[.]{10,}$/i
			},
		  messages : {
		    'wrong' : 'Následující položka má špatný formát: '
		  },
		  testRegExp : function(ref, value) {
		    return this.objRegExp[ref].test(value) ? true : false;
		  }
		}
		
		if (Ch.testRegExp('email',$mail)) {
			if ($text == "Váš dotaz..." || $text == "Ваш вопрос..." || $text == "Your question" || $text.length < 10) {
				alert(Ch.messages['wrong'] + 'Váš dotaz');
				return false;
			}
			//alert('OK');
		}else{
			alert(Ch.messages['wrong'] + 'Váš e-mail');
			return false;
		}
		
	});
	
	$('#mailform-button-en').click(function(){
	  $text_company = $('input#company').val();	
		$text_contactperson = $('input#contact-person').val();
    $text_phoneorder = $('input#phone-order').val();
    $mailen = $('input#mail-order').val();
    $text_website = $('input#website').val();
    $text_country = $('input#country').val();
     
		var Ch = {
		  objRegExp : {
		    'mail-order' : /^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$/i
			},
		  messages : {
		    'wrong' : 'The following entry has wrong format: '
		  },
		  testRegExp : function(ref, value) {
		    return this.objRegExp[ref].test(value) ? true : false;
		  } 
		}
		
	 if ($text_company == "Name of company*"){
      alert(Ch.messages['wrong'] + 'Name of company');
			return false;
   } 
   
   if ($text_contactperson == "Contact person*"){
      alert(Ch.messages['wrong'] + 'Contact person');
			return false;
   }
   
    if ($text_phoneorder == "Phone*"){
      alert(Ch.messages['wrong'] + 'Phone');
			return false;
   } 
   
   	
		if (Ch.testRegExp('mail-order',$mailen)) {
			//alert('OK');
		}else{
			alert(Ch.messages['wrong'] + 'E-mail');
			return false;
		}
		
		 if ($text_website == "Company web site address*"){
      alert(Ch.messages['wrong'] + 'Company web site address');
			return false;
   }
   
    if ($text_country == "Country of residence*"){
      alert(Ch.messages['wrong'] + 'Country of residence');
			return false;
   }
   	
	});
});

// Zmizeni textu pri najeti na vyhledavaci polozku a zmena stylu

function input_focus(object, label) {
	if (object.value == label) {
		object.value= ''; 
	}
	return true;
}

function input_blur(object, label) {
	if (object.value == '') {
		object.value= label; 
	}
	return true;
}
