<!-- Begin
// JavaScript Document
function toggleLayer( whichLayer , action)
{
var elem, vis;
if( document.getElementById ) // this is the way the standards work
elem = document.getElementById( whichLayer );
else if( document.all ) // this is the way old msie versions work
elem = document.all[whichLayer];
else if( document.layers ) // this is the way nn4 works
elem = document.layers[whichLayer];
vis = elem.style;
// if action is show just show it without checking current status 
if (action == 'show')
	vis.display = 'block';
else if (action == 'hide')
	vis.display = 'none';
else { // toggle 
// if the style.display value is blank we try to figure it out here
if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
vis.display = (vis.display==''||vis.display=='block')?'none':'block';
} 
}

function toggleLayer_v1( whichLayer )
{
var elem, vis;
if( document.getElementById ) // this is the way the standards work
elem = document.getElementById( whichLayer );
else if( document.all ) // this is the way old msie versions work
elem = document.all[whichLayer];
else if( document.layers ) // this is the way nn4 works
elem = document.layers[whichLayer];
vis = elem.style;

// if the style.display value is blank we try to figure it out here
vis.display = (vis.display==''||vis.display=='none')?'block':'none';
 
}

function validate_form ( )
{
    valid = true;

if ( ( document.item_form.ship_with[0].checked == false )
    && ( document.item_form.ship_with[1].checked == false ) )
    {
        alert ( "الرجاء اختيار نوع الشحن." );
        valid = false;
    }

    return valid;
}

function validate_shipping(){
if (check_shipping())
	 window.location.href = 'shipping.php';
}

function check_shipping(){
for(i=0; i<document.myform.shipping_total.value; i++)
{
shipping1 = "shipping" + i ;
shipper = document.getElementById(shipping1);
if (shipper.value == ""){
	alert("الرجاء اختيار شركات الشحن");
	return false;
}
}
return true;
}

function CheckFieldLength(fn,wn,rn,mc) {
  var len = fn.value.length;
  if (len > mc) {
    fn.value = fn.value.substring(0,mc);
    len = mc;
  }
  document.getElementById(wn).innerHTML = len;
  document.getElementById(rn).innerHTML = mc - len;
}

function confirmdelete(title) {  
return confirm("هل تريد بالتأكيد حذف ؟ " + title );   
} 

function acceptEnglishOnly()
{
if (event.keyCode == 012) 
	event.returnValue = true;

if ((event.keyCode > 127) || (event.keyCode < 32)) 
	event.returnValue = false;
}

// this function make radio_name choosed if the user start typing in specific text field 
function choose_radio(radio_id){
radio_choosed = document.getElementById(radio_id);
radio_choosed.checked = true ;
return true;
}
//  End -->
