$(window).bind('load', function () {
  roundTheCorners('.innovationPic');

});



function mouseOver()
{
 document.getElementById('b1').src ="button-corporate.gif";
}

function mouseOut()
{
 document.getElementById('b1').src ="buttonnonseleceted.gif";
}



function createUrlCookie() {

      var name = "originUrl";
      var value = document.URL;
      var days = 1;  
	var date = new Date();
	date.setTime(date.getTime()+(days*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	document.cookie = name+"="+value+expires+"; path=/";

}



function createProdCookie(productName) {
// executed just if the cookie is empty -> so value will contain just one product
      var name = "enquiryBoxValue";
       var value = productName

    
      var days = 1;  
	var date = new Date();
	date.setTime(date.getTime()+(days*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	document.cookie = name+"="+value+expires+"; path=/";


createUrlCookie();

}



function createMarketCookie(myMarket) {

      var name = "favMarket";
       var value = myMarket
    
      var days = 30;  
	var date = new Date();
	date.setTime(date.getTime()+(days*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	document.cookie = name+"="+value+expires+"; path=/";

}


function Delete_Cookie( name, path, domain ) {
if ( readCookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}



function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function FillForm() 
{

var valuetoadd = readCookie('enquiryBoxValue');
if (valuetoadd)
{
 document.getElementById("enquiryBox").value= valuetoadd;

Delete_Cookie('enquiryBoxValue','/','');
}
}

function doScrollOffset()
{
  var theBoxes= document.getElementById('shiftingDiv').getElementsByTagName('div');
  var selectedRange= document.getElementById('displayedRange');

var boxIndex = 0;
for (i=0; i<theBoxes.length; i++)
 if (theBoxes[i].id == 'displayedRange'){ boxIndex = i; break;}


document.getElementById('rangesBox').scrollLeft = boxIndex*130-240; 

}



function roundTheCorners(theDiv)
{
  theImg = $(theDiv +' img')
  $(theDiv).append('<div></div>')
  theinnerDiv = $(theDiv + ' div')
   theinnerDiv.css({'margin':'auto','height':theImg.height(),'width':theImg.width(),'backgroundImage':'url("'+theImg.attr('src')+'")'})

  theinnerDiv.append('<div class="corner1"><div class="corner2"><div class="corner3"><div class="corner4"></div></div></div></div>')
  theinnerDiv.find(' div').css({'height':theImg.height(),'width':theImg.width()})

  theImg.remove()
}
