//document ready functions
$(window).load(function() {

	//set footer position based on content height
	 //   var cHeight = $('#content_bg').height();
	
	    //total height including top header
	  //  var tHeight = cHeight + 200;
    
	  //  $('#footer').css({top: tHeight});
	
	    
	//fix ie6 png
	 //   DD_belatedPNG.fix('img,li');
	//    DD_roundies.addRule('.clearfix li','7px 7px 0 0',true);
	 //   DD_roundies.addRule('#content_bg','10px 0 0 0',true);
	
	//tracking on enter pressed
	$("#search_val").keyup(function(event){
		  if(event.keyCode == 13){
		    search_track();
		  }
		});	     
           	
});

//tracking function
function submitForm_irishtrack()
{	
consignmentID = document.getElementById('pknr').value;
consignmentID = consignmentID.replace(/^\s+|\s+$/g, '');
/*var validChars = "0123456789.";
var char;

for (i = 0; i < consignmentID.length;  i++) 
  	{ 
  		char = consignmentID.charAt(i); 
  		if (validChars.indexOf(char) == -1) 
     	{         		alert('Consignment Number must be numeric. Re-Enter');
		return;
     	}      	}   */    
   var action = "http://www2.dpd.ie/Services/QuickTrack/tabid/222/ConsignmentID/" + consignmentID + "/Default.aspx";
   document.forms["pnr_form"].action = action;
   document.forms["pnr_form"].submit();
}


//tracking search combined - function to seperate tracking from search
function search_track()
{
    var search_val = $('#search_val').val();   //user data input
    var search_mod = document.getElementById('cntnt01searchinput'); //seach module input box
    var tracking_mod = document.getElementById('pknr');             //tracking module input box
    
    
    //check if value is not a number
    if(isNaN(search_val) == true)
    {
    	//submit search module if value is not a number
        search_mod.value = search_val;
            
        document.forms['cntnt01moduleform_1'].submit();
    }else        
    	{
    	    //submit tracking module   
            consignmentID = search_val;
            consignmentID = consignmentID.replace(/^\s+|\s+$/g, '');
        
            var action = "http://www2.dpd.ie/Services/QuickTrack/tabid/222/ConsignmentID/" + consignmentID + "/Default.aspx";
            document.forms["pnr_form"].action = action;
            document.forms["pnr_form"].submit();
    	}      
        
    
}


