
      function switchBckgrndImg(){

      document.body.style.backgroundImage="";

      var x,y;

      if (self.innerHeight) // all except Explorer

      {

      x = self.innerWidth;

      y = self.innerHeight;

      }

      else if (document.documentElement && document.documentElement.clientHeight)

      // Explorer 6 Strict Mode

      {

      x = document.documentElement.clientWidth;

      y = document.documentElement.clientHeight;

      }

      else if (document.body) // other Explorers

      {

      x = document.body.clientWidth;
 
      y = document.body.clientHeight;
  
      }
  
      // THE FOLLOWING assigns a background image to each resolution
  
      myscreenWidth = x;
  
      if(myscreenWidth <=800) 
	
	{ 
		var myImg ="http://rbmoto.lv/lv/wp-content/themes/WP-Gothenburg/fons/800.jpg";
	}
  
      else if(myscreenWidth <=1024) 
	
	{ 
		var myImg ="http://rbmoto.lv/lv/wp-content/themes/WP-Gothenburg/fons/1024.jpg";
	}
  
      else if(myscreenWidth <=1152) 

	{ 
		var myImg ="http://rbmoto.lv/lv/wp-content/themes/WP-Gothenburg/fons/1152.jpg";
	}
  
      else if(myscreenWidth <=1280) 
	
	{ 
		var myImg ="http://rbmoto.lv/lv/wp-content/themes/WP-Gothenburg/fons/1280.jpg";
	}

	else if(myscreenWidth <=1440)
	
	{ 
		var myImg ="http://rbmoto.lv/lv/wp-content/themes/WP-Gothenburg/fons/1440.jpg";
	}

	else if(myscreenWidth <=1650) 
	
	{ 
		var myImg ="http://rbmoto.lv/lv/wp-content/themes/WP-Gothenburg/fons/1650.jpg";
	}
  
	else 
	
	{ 
	var myImg ="http://rbmoto.lv/lv/wp-content/themes/WP-Gothenburg/fons/1920.jpg";
	}
  
      // image switching occurs now !
  
      document.body.style.backgroundImage="url("+myImg +")";
  
      //alert("width = "+myscreenWidth);
  
      }
  
       
  
      function onResizeHandler()
  
      {
  
      // ALL FUNCTION CALLS TO PERFORM ON RESIZE...
  
      switchBckgrndImg();
  
      }
  
      function onLoadHandler()
  
      {
  
      // ALL FUNCTION CALLS TO PERFORM ON LOAD...
  
      switchBckgrndImg();
  
      }
  
      window.onresize = onResizeHandler;
  
      window.onload = onLoadHandler;


