//Toolbar Install Functions 
function install_tb_complete (name, result) {
						   if (result != 0 && result != 999){
							// alert("An error occured: " + result);
						   }
						   else 
							   alert ("Restart the browser to finish installation");
                       }
                       function Install_tb_XPI () {
							var xpi = new Object ();
							xpi["sawa.cec.sy"] = "http://www.cec.sy/tbar/sawa.cec.sy.xpi";
							InstallTrigger.install (xpi, install_tb_complete);
                       }
function Install_tb_XPI () {
	var xpi = new Object ();
	xpi["sawa.cec.sy"] = "http://www.cec.sy/tbar/sawa.cec.sy.xpi";
	InstallTrigger.install (xpi, install_tb_complete);
}
//End of Toolbar Install

//Translation
function is_valid_char(word) {
	var inputText = word;
	inputText = inputText.toLowerCase();
	for(i = 0; i < inputText.length; i++) {
		if ( 
		inputText.charAt(i) != "a" && inputText.charAt(i) != "b" && inputText.charAt(i) != "c" &&
		inputText.charAt(i) != "d" && inputText.charAt(i) != "e" && inputText.charAt(i) != "f" &&
		inputText.charAt(i) != "g" && inputText.charAt(i) != "h" && inputText.charAt(i) != "i" &&
		inputText.charAt(i) != "j" && inputText.charAt(i) != "k" && inputText.charAt(i) != "l" &&
		inputText.charAt(i) != "m" && inputText.charAt(i) != "n" && inputText.charAt(i) != "o" &&
		inputText.charAt(i) != "p" && inputText.charAt(i) != "q" && inputText.charAt(i) != "r" &&
		inputText.charAt(i) != "s" && inputText.charAt(i) != "t" && inputText.charAt(i) != "u" &&
		inputText.charAt(i) != "v" && inputText.charAt(i) != "w" && inputText.charAt(i) != "x" &&
		inputText.charAt(i) != "y" && inputText.charAt(i) != "z" && inputText.charAt(i) != " " &&
		inputText.charAt(i) != "0" && inputText.charAt(i) != "1" && inputText.charAt(i) != "2" &&
		inputText.charAt(i) != "3" && inputText.charAt(i) != "4" && inputText.charAt(i) != "5" &&
		inputText.charAt(i) != "6" && inputText.charAt(i) != "7" && inputText.charAt(i) != "8" &&
		inputText.charAt(i) != "9" && inputText.charAt(i) != "-" && inputText.charAt(i) != "?" &&
		inputText.charAt(i) != "_" && inputText.charAt(i) != "&" && inputText.charAt(i) != "@"  ) 
		{
			return false;
			
		}
	}//end for loop
	return true;
}//end function 

//starting code of Ajax
var http = createRequestObject();
function createRequestObject(){
    var req;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else{
        req = new XMLHttpRequest();
    }
    return req;
}

function getInfo(){
	var url = 'response.php?word=';
    http.open('get', url + document.form1.word.value);
    http.onreadystatechange = handleInfo;
    http.send(null);
}
function handleInfo(){
    if(http.readyState == 1){
        document.getElementById('view_res').innerHTML = '....&#1580;&#1575;&#1585;&#1610; &#1575;&#1604;&#1576;&#1581;&#1579; &#1593;&#1606; &#1575;&#1604;&#1605;&#1593;&#1606;&#1609;';
    }
    if(http.readyState == 4){
        var response = http.responseText;
        document.getElementById('view_res').innerHTML = response;
    }
}
//End of Translation

function show(id)
{
	el = document.getElementById(id);
	if (el.style.display == 'none')
	{
		el.style.display = 'block';
	}else el.style.display = 'none';;
}
function hide(id)
{
	el = document.getElementById(id);
	if (el.style.display == 'block')
	{
		el.style.display = 'none';
	}
}
/*make multile input texts */

	var num_row = 0;												
	function addAnotherRow()
	{
		var table = document.getElementById ("card_table");
		var length = table.rows.length;
		var newRow = table.insertRow(-1);
		var cell0 = newRow.insertCell(-1);
		var cell1 = newRow.insertCell(-1);
		var cell2 = newRow.insertCell(-1);
		//var cell3 = newRow.insertCell(-1);
		cell1.innerHTML = '\n\<input  type="text" name="order_pin[]" dir="ltr"/>';				
		cell0.innerHTML = '\n\<strong><p>بطاقة سوا  </p></strong>';				
		//cell2.innerHTML = '\n\<strong><p>:  </p></strong>';	
		newRow.dir = 'rtl';
		num_row = num_row + 1;
	}
			
	function removeRow()
	{
		if (num_row > 0)
		{
			var table = document.getElementById ("card_table");
			var length = table.rows.length;
			table.deleteRow( num_row );
			num_row = num_row - 1;
		}	
	}
		

	function funCheck()
	{
		if (document.register.offer_id.value == '')
		{
			alert('يرجى اختيار العرض ');
            document.register.offer_id.focus();
            return false;
	    }
		return true;
	}
	
	
	function check_domain()
	{
		
		var domian_name = register.domain_name.value;
		if (domian_name != '')
		{
			window.open('http://who.is/ip-address/'+domian_name, '', 'width=800,height=600');
		}
		else
		{
			alert('ادخل اسم النطاق');
            document.register.domain_name.focus();
		}
		
		
	}
