var ns4 = (document.layers)? true:false;					//NS 4
var ie4 = (document.all)? true:false;							//IE
var dom = (document.getElementById)? true:false;	//NS 6 ou IE5
function setDiv(ID,Content) {
	if (dom) {$(ID).innerHTML = Content;return;}
	if (ie4) {document.all[ID].innerHTML = Content;return;}
	if (ns4) {with (eval('document.'+ID+'.document')) {open();write(Content);close();return;}}
}
function getDiv(ID) {
	if (dom) {
		return $(ID).innerHTML;
	}
	if (ie4) {
		return document.all[ID].innerHTML;
	}
	if (ns4) {
		return "";
	}
}
//
//function $(id){return document.getElementById(id);}
//
function lc_countdown(timestamp,expiredate){
	var d="";
	var dt = new Date();
	var now= dt.getTime();
	if( Math.floor(now/1000) < timestamp){
		dt.setTime((timestamp*1000)-dt);
		var jour = dt.getDate()-1;
		if(jour<=0){
			d = "";
		}else{
			if(jour>1){
				d="<b>"+jour+"</b> jours &bull; ";
			}else{
				d="<b>1</b> jour &bull; ";
			}
		}
		setDiv(timestamp,"<span style='text-decoration:blink'><b style='color:red'>PRIX PROMO FLASH</b> valable jusqu'au <b>"+expiredate+"</b></span><br><img src='images/icons/chrono.gif' align=absmiddle> il vous reste "+d+"<b>"+dt.getHours()+"</b>h <b>"+dt.getMinutes()+"</b>min <b>"+dt.getSeconds()+"</b>s");
		window.setTimeout("lc_countdown('"+timestamp+"','"+expiredate+"')",1000);
	}
}

function createPlayer(target,thefile,w,h,autostart,repeat) {
	autostart=false;
    var flashvars = {
            file:thefile, 
            autostart:autostart,
            playlistsize:"240",
            controlbar:"over",
            playlist:"off",
            screencolor:"#000000",
            stretching:"uniform",
            volume: "10",
            repeat:repeat
    }
    var params = {
            allowfullscreen:"true", 
            allowscriptaccess:"always",
            wmode:"opaque"
    }
    var attributes = {
    }
    swfobject.embedSWF(host+"flash/videoPlayer.swf", target, w, h, "6", false, flashvars, params, attributes);
}
/*createPlayer("video_chaussettes","http://www.123snooper.fr/flash/video_001 demo3.flv","180","150","true","always");*/

$(document).ready(function() {
	if($("#issec_tool").length>0){
		$("#issec_tool").append('<fieldset class="uiTool"><legend>Veuillez indiquer les dimensions de vos pneus:</legend><form id="issec_form"><input type="hidden" name="uiTool" value="issec" /><div id="issec_response"></div></form></fieldset>');
	    var options = { 
	        target:        '#issec_response',
	        url:       window.location.href,/*'http://www.123snooper.fr/chaines-neige-chaussettes-neige-auto-c-85_89.html',*/
	        type:      'post' 
	    }; 
	    $("#issec_form").ajaxForm(options);
	    $('#issec_form').submit();
    };
}); 
 
// pre-submit callback
function showRequest(formData, jqForm, options) { 
    // formData is an array; here we use $.param to convert it to a string to display it 
    // but the form plugin does this for you automatically when it submits the data 
    var queryString = $.param(formData); 
 
    // jqForm is a jQuery object encapsulating the form element.  To access the 
    // DOM element for the form do this: 
    // var formElement = jqForm[0]; 
 
    alert('About to submit: \n\n' + queryString); 
 
    // here we could return false to prevent the form from being submitted; 
    // returning anything other than false will allow the form submit to continue 
    return true; 
} 
 
// post-submit callback 
function showResponse(responseText, statusText)  { 
    // for normal html responses, the first argument to the success callback 
    // is the XMLHttpRequest object's responseText property 
 
    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'xml' then the first argument to the success callback 
    // is the XMLHttpRequest object's responseXML property 
 
    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'json' then the first argument to the success callback 
    // is the json data object returned by the server 
 
    alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
        '\n\nThe output div should have already been updated with the responseText.'); 
}
//
