<div class="page">
    <div class="inner">
        <div class="left_page_1">
            <h2 class="page_title">Boutique</h2>
            <div class="content" style="min-height: 730px;">
            
                <div class="arrianne"><a href="/">Accueil</a> &gt; <a href="index.php?mod=produits">Boutique</a> &gt; Inscription</div>
                <h3 class="section_title">Inscription</h3><br />
                <?php
                
                echo "<pre>";
                print_r($_POST);
                echo "</pre>";
                
                if ($_GET[activation]){
                    $check = mysql_fetch_array(mysql_query("SELECT * FROM membre WHERE temp='$_GET[activation]'"));
                    if ($check[id]){
                        $update = mysql_query("UPDATE membre SET temp='' WHERE temp='$_GET[activation]'");
                        $good = "<div style='height:auto !important; margin: -57px 13px 7px !important; line-height:17px !important;' class='good_stay'>
                        Votre compte est meintenant activé. Vous alez être redirigé au panier dans quelques secondes</div>";
                        $_SESSION = $check;
                        echo '<meta http-equiv="refresh" content="2; url=index.php?mod=cart">';
                    }else{
                        $good = "<div style='height:auto !important; margin: -57px 13px 7px !important; line-height: 38px;' class='bad_stay'>Clée d'activation invalide</div>";
                        echo '<meta http-equiv="refresh" content="2; url=index.php?mod=cart">';
                    }
                    $dont=1;
                }
                if ($error){
                    echo $error;    
                }
                if ($good){
                    echo $good;
                    $dont=1;
                }
                
                if($dont==""){
                    ?>                
                    <form method="post" name="inscription">
                        <table>
                            <tr>
                                <td class="cart_title" colspan="2"><span style="width: 670px;">Informations de connexion</span></td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Courriel</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span><input class="login_input" type="text" name="courriel" value="<?=$_POST[courriel]?>" size="20"/></span></td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Mot de passe</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span><input class="login_input" type="password" name="passe1" size="20"/></span></td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Confirmation du mot de passe</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span><input class="login_input" type="password" name="passe2" size="20"/></span></td>
                            </tr>
                            <tr>
                                <td class="cart_title" colspan="2"><span style="width: 670px;">Informations personelle</span></td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Nom</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span><input class="login_input" type="text" name="nom" value="<?=$_POST[nom]?>" size="20"/></span></td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Prénom</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span><input class="login_input" type="text" name="prenom" value="<?=$_POST[prenom]?>" size="20"/></span></td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Téléphone</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span><input class="login_input" type="text" name="tel" value="<?=$_POST[tel]?>" size="20"/></span></td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Continent</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span>
                                    <select name="continent" id="continent" onchange="getplaces(this.value,'country');">
                                        <option value="<?=$_POST[continent]?>"></option>						
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Pays</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span>
                                    <select name="country" id="country" onchange="getplaces(this.value,'province');">
                                        <option value="<?=$_POST[country]?>"></option>						
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Province</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span>
                                    <select name="province" id="province" onchange="getplaces(this.value,'region')">
                                        <option value="<?=$_POST[province]?>"></option>						
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Région</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span>
                                    <select name="region" id="region" onchange="getplaces(this.value,'city')">
                                        <option value="<?=$_POST[region]?>"></option>						
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Ville</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span>
                                    <select name="city" id="city">
                                        <option value="<?=$_POST[city]?>"></option>						
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Code postal ou équivalent</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span><input class="login_input" type="text" name="cp" size="20"/></span></td>
                            </tr>
                            <tr>
                                <td class="cart_prod_small" valign="middle" align="left"><span>Adresse civique</span></td>
                                <td class="cart_prod_small" valign="middle" align="left"><span><input class="login_input" type="text" name="adresse" size="20"/></span></td>
                            </tr>
                            <tr>
                                <td colspan="2"><input style="float:right;margin-top:5px;" class="bouton_insc" type="submit" value=" " name="inscription_form" /></td>
                            </tr>
                        </table>
                    </form>
                    <?php
                }
                ?>                   
            </div>
        </div>
        <div class="right_page_1">
            <?php include("produits_menu.php"); ?>
        </div>
        <div style="clear: both; height:10px;"></div>
    </div>
</div>
<script type="text/javascript">
    var whos=null;
    function getplaces(gid,src)
    {	
    	whos = src
    	var request = "http://www.geonames.org/childrenJSON?geonameId="+gid+"&callback=listPlaces&style=long&lang=fr";
    	aObj = new JSONscriptRequest(request);
    	aObj.buildScriptTag();
    	aObj.addScriptTag();	
    }
    
    function listPlaces(jData)
    {
    	counts = jData.geonames.length<jData.totalResultsCount ? jData.geonames.length : jData.totalResultsCount
    	who = document.getElementById(whos)
    	who.options.length = 0;
    	
    	if(counts)who.options[who.options.length] = new Option('Select','')
    	else who.options[who.options.length] = new Option('No Data Available','NULL')
    			
    	for(var i=0;i<counts;i++)
    		who.options[who.options.length] = new Option(jData.geonames[i].name,jData.geonames[i].geonameId)
    
    	delete jData;
    	jData = null		
    }
    
    window.onload = function() {
        <?php 
            if ($_POST[continent]){ 
                echo 'getplaces('.$_POST[continent].',\'country\');'."\n";
            }else{ 
                echo 'getplaces(6295630,\'continent\');'."\n";
            }
            if ($_POST[country]){echo 'getplaces('.$_POST[country].',\'country\');'."\n";}
            if ($_POST[province]){echo 'getplaces('.$_POST[province].',\'province\');'."\n";}
            if ($_POST[region]){echo 'getplaces('.$_POST[region].',\'region\');'."\n";}
            if ($_POST[city]){echo 'getplaces('.$_POST[city].',\'city\');'."\n";}
        ?>
    }
</script>