
function CacheImages(){
	if (document.images) {
		var imgs=new Array('site_pictures/nav_shopping_on.gif', 
												'site_pictures/nav_hrana_on.gif',
												'site_pictures/nav_zabava_on.gif',
												'site_pictures/nav_ostalo_on.gif',
												'site_pictures/bcg_shopping.png',
												'site_pictures/bcg_hrana.png',
												'site_pictures/bcg_zabava.png',
												'site_pictures/bcg_ostalo.png',
												'site_pictures/btn_shopping_on.png',
												'site_pictures/btn_hrana_on.png',
												'site_pictures/btn_zabava_on.png',
												'site_pictures/btn_ostalo_on.png',

												'site_pictures/event_btn_on.png',
												'site_pictures/archive_on.png',
												'site_pictures/submit_on.png',

												'site_pictures/baloon_top.png',
												'site_pictures/baloon_bottom.png',
												'site_pictures/baloon_middle.png'
												);
		var dummy = new Array();
		for (s in imgs){
			dummy[s] = new Image();
			dummy[s].src = imgs[s];
	  }
	}
}

function jQueryAjaxRequest(targeturl,parameters,resultdiv, ctype){
	$.ajax({
		type: ctype,
		url: targeturl,
		data: parameters,
		contentType: "application/x-www-form-urlencoded",
		dataType: "html",
		success: function(response) {
			$('#'+resultdiv).html(response);
		}
	});
}


  function AjaxRequest(requestType, targetUrl, parameters, resultDiv, startFunc, endFunc, errorFunc, repeatCount){
       if (!repeatCount && repeatCount != 0) repeatCount=2;
       if (startFunc) startFunc();
   $.ajax({
      type: requestType,
      url: targetUrl,
      timeout: 60000, 
      data: parameters,
      contentType: "application/x-www-form-urlencoded",
      dataType: "html",
      success: function(response) {
         $('#'+resultDiv).html(response);
         if (endFunc) endFunc();
      },
                       error: function( objAJAXRequest, strError ){
//                                if (strError == 'timeout'){
                                       if (repeatCount < 0){
                                               if (errorFunc) errorFunc(parameters);
                                       }else{
                                               AjaxRequest(requestType, targetUrl, parameters, resultDiv, startFunc, endFunc, errorFunc, --repeatCount);
                                       }
//                                }else{
//                                        alert(strError);
//                                }
                       }
   });
 }
 
 function getWindowWidth() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
	return myWidth;
}

