﻿/* arabic */
$(document).ready(function(){
$("#login").click(function(){
});
// When the form is submitted
$("#status > form").submit(function(){
// 'this' refers to the current submitted form
var str = $(this).serialize();
// -- Start AJAX Call --
$.ajax({
    type: "GET",
    url: "../news/user/dalylak_login.php",  // Send the login info to this page
    data: str,
    success: function(msg){
$("#status").ajaxComplete(function(event, request, settings){
if(msg == 'OK') // LOGIN OK?
{
var login_response = '<img style="margin-top:20px;" align="center" src="images/ajax-loader.gif"><br /><br />سوف يتم التحويل إلى صفحة الإشتراك<br /><br /><a href="http://www.dalylak.com/news/user/admincp.php" target="_blank">إذا لم يتم التحويل إضغط هنا</a>';  
$(this).html(login_response); // Refers to 'status'
// After 3 seconds redirect the
setTimeout('go_to_private_page()', 3500);
}
else // ERROR?
{
var login_response = '<div id="notification_error">دخول خاطئ, الرجاء التأكد من المعلومات.</div>';
$('#login_response').html(login_response);
}
});
}   
});  
// -- End AJAX Call --
return false;
}); // end submit event
});
function go_to_private_page() {
window.open('http://www.dalylak.com/news/user/admincp.php', '_blank');
}



/* english */
$(document).ready(function(){
$("#login_en").click(function(){
});
// When the form is submitted
$("#status_en > form").submit(function(){
// 'this' refers to the current submitted form
var str = $(this).serialize();
// -- Start AJAX Call --
$.ajax({
    type: "GET",
    url: "../news/user/dalylak_login.php",  // Send the login info to this page
    data: str,
    success: function(msg){
$("#status_en").ajaxComplete(function(event, request, settings){
if(msg == 'OK') // LOGIN OK?
{
var login_response_en = '<div style="direction:ltr;"><img style="margin-top:20px;" align="center" src="images/ajax-loader.gif"><br /><br />Please wait a few seconds<br /><br /><a href="http://www.dalylak.com/news/user/admincp.php" target="_blank">Or you can click here</a></div>';
$(this).html(login_response_en); // Refers to 'status'
// After 3 seconds redirect the
setTimeout('go_to_private_page()', 3500);
}
else // ERROR?
{
var login_response_en = '<div id="notification_error" style="direction:ltr;">Error Login !!</div>';
$('#login_response_en').html(login_response_en);
}
});
}   
});  
// -- End AJAX Call --
return false;
}); // end submit event
});
function go_to_private_page() {
window.open('http://www.dalylak.com/news/user/admincp.php', '_blank');
}
