var options = "width=725,height=500,scrollbars=yes,resizable=yes,menubar=yes,status=no,toolbar=no,location=no,directories=no,screenX=50,screenY=50";
var optionsnews = "height=475,scrollbars=yes,resizable=yes,menubar=yes,status=no,toolbar=no,location=no,directories=no";
var adNum=0;
var adNumDubai=0;
var adNumAleppo=0;

//************************************************************************
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

//************************************************************************
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//************************************************************************
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break; 
}
return null;
}  

//************************************************************************
function open_link(URL) {
  var ScreenH = screen.height-100;
  var ScreenW = screen.width-40;
  var mLeft = (screen.width - ScreenW) /2 ;
  if (URL) {
    ewin=open(URL, '', 'height='+ScreenH+',width='+ScreenW+',menubar=yes,left=10,top=10,scrollbars=yes,resizable=yes,status=no,toolbar=no,location=no,directories=no');
  }
}

//************************************************************************
function SetCookieSp (name, value, expires) {
var argv = SetCookieSp.arguments;
var argc = SetCookieSp.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

//************************************************************************
function opennews(URL) {
  if (URL) {
    window.open(URL, 'whatsnewwin', optionsnews);  
  }
}

//************************************************************************
function setCookie(){
  document.cookie = 'isload=0';   
}

//************************************************************************
function pc(){
  var mCookLoad=GetCookie('isload');
  var mCook=GetCookie('adNum');
  var mCook=GetCookie('adNumDubai');
  var mCook=GetCookie('adNumAleppo');
  var mBannerAdNum;
  var mCookString;
  var mDate= new Date(3000,1,1);
  if ((mCookLoad == null) || (mCookLoad == 0)) {
    document.cookie = 'isload=1';
	if (navigator.appName != 'Netscape') {
      self.location.reload();
	}
    if ((mCook == null) || (mCook == 0)) {
      mBannerAdNum=1;
    }
    else
    { 
      mBannerAdNum=eval(mCook)+1;
    }
    SetCookieSp('adNum',mBannerAdNum, mDate);
    SetCookieSp('adNumDubai',mBannerAdNum, mDate);
    SetCookieSp('adNumAleppo',mBannerAdNum, mDate);
  }
}

//************************************************************************
function getEmailValue(){
  return document.write('<input name="custemail" type="hidden" id="custemail11" value="'+opener.GetCookie('cookEmail')+'">');
}
//************************************************************************
function getLinkValue(){
  return document.write('<input name="link" type="hidden" id="custemail11" value="'+opener.GetCookie('cookLink')+'">');
}
//************************************************************************
function getCityCnValue(){
  return document.write('<input name="citycn" type="hidden" id="custemail11" value="'+opener.GetCookie('cookCityCn')+'">');
}
//************************************************************************
function sendamessage(mEmail, mComName, mLang, mCityCn){
  var mURL = '../../misc/'+mLang+'/custmail.htm';
  var ScreenH = 450;
  var ScreenW = 550;
  var mLeft = (screen.width - ScreenW) /2 ;
  var mTop = (screen.height - ScreenH) /2 ;
  
  SetCookieSp('cookComName',mComName);
  SetCookieSp('cookEmail',mEmail);
  SetCookieSp('cookCityCn',mCityCn);
  SetCookieSp('cookLang',mLang);
  
  ewin=open(mURL,'whatsnewwin', 'height='+ScreenH+',width='+ScreenW+',left='+mLeft+',top='+mTop+',scrollbars=no,resizable=yes,status=no,toolbar=no,location=no,directories=no');
}
//************************************************************************
function sendlink(mLink, mComName, mLang, mCityCn){
  var mURL = '../../misc/'+mLang+'/mailpage.htm';
  var ScreenH = 350;
  var ScreenW = 550;
  var mLeft = (screen.width - ScreenW) /2 ;
  var mTop = (screen.height - ScreenH) /2 ;
  
  SetCookieSp('cookComName',mComName);
  SetCookieSp('cookLink',mLink);
  SetCookieSp('cookLang',mLang);
  SetCookieSp('cookCityCn',mCityCn);

  ewin=open(mURL,'whatsnewwin', 'height='+ScreenH+',width='+ScreenW+',left='+mLeft+',top='+mTop+',scrollbars=no,resizable=yes,status=no,toolbar=no,location=no,directories=no');
}
//************************************************************************
function bookIt(argVal)
{
  // <a href="JavaScript: bookIt('http://www.dalylak.com|Asd');">Add to Fav.</a>
  var bookData = new Array();
  bookData = argVal.split("|");
  if (document.all)
    window.external.AddFavorite(bookData[0], bookData[1]);
  else
    alert("Sorry. Netscape users must bookmark the pages manually by hitting <Ctrl-D>");
}
//************************************************************************
function getCityList(mLang, mCityCode, targetFile){
  var mParent="'parent'";
  var mTargetFile=targetFile;
  if (mTargetFile=='') {
    mTargetFile=mLang+'main'+mCityCode+'htm';
  }
  if (mCityCode == "00001") {
    var mSelected1='Selected';
    var mSelected2='';
    var mSelected3='';
  }
  if (mCityCode == "00002") {
    var mSelected1='';
    var mSelected2='Selected';
    var mSelected3='';
  }
  if (mCityCode == "00003") {
    var mSelected1='';
    var mSelected2='';
    var mSelected3='Selected';
  }
  
  document.write('<select class="textinput" name="menu1" onChange="MM_jumpMenu('+mParent+',this,0)">');
  if (mLang == "a") {
	document.write('<option value="../../00001/a/'+mTargetFile+'" '+mSelected1+'>سوريا - دمشق</option>');
	document.write('<option value="../../00002/a/'+mTargetFile+'" '+mSelected2+'>الأمارات - دبي</option>');
	document.write('<option value="../../00003/a/'+mTargetFile+'" '+mSelected3+'>سوريا - حلب</option>');
  } else {
	document.write('<option value="../../00001/e/'+mTargetFile+'" '+mSelected1+'>Syria - Damascus</option>');
	document.write('<option value="../../00002/e/'+mTargetFile+'" '+mSelected2+'>UAE - Dubai</option>');
	document.write('<option value="../../00003/e/'+mTargetFile+'" '+mSelected3+'>Syria - Aleppo</option>');
  }
  document.write('</select>');
}

//************************************************************************
function getMainCityList(mLang, mCityCode){
  var mParent="'parent'";
  if (mCityCode == "00001") {
    var mSelected1='Selected';
    var mSelected2='';
    var mSelected3='';
  }
  if (mCityCode == "00002") {
    var mSelected1='';
    var mSelected2='Selected';
    var mSelected3='';
  }
  if (mCityCode == "00003") {
    var mSelected1='';
    var mSelected2='';
    var mSelected3='Selected';
  }
  
  document.write('<select class="textinput" name="menu1" onChange="MM_jumpMenu('+mParent+',this,0)">');
  if (mLang == "a") {
	document.write('<option value="amain00001.htm" '+mSelected1+'>سوريا - دمشق</option>');
	document.write('<option value="amain00002.htm" '+mSelected2+'>الأمارات - دبي</option>');
	document.write('<option value="amain00003.htm" '+mSelected3+'>سوريا - حلب</option>');
  } else {
	document.write('<option value="emain00001.htm" '+mSelected1+'>Syria - Damascus</option>');
	document.write('<option value="emain00002.htm" '+mSelected2+'>UAE - Dubai</option>');
	document.write('<option value="emain00003.htm" '+mSelected3+'>Syria - Aleppo</option>');
  }
  document.write('</select>');
}

//************************************************************************
function viewImage(img_name) {
  img_var = new String()
  v = new Image;
  v.src=img_name;
  var imgWidth=v.width;
  var imgHeight=v.height

  var ScreenW = imgWidth+40;
  var ScreenH = imgHeight+50;
  
  var mLeft = (screen.width - ScreenW) /2 ;
  var mTop = (screen.height - ScreenH) /2 ;
  
  img_var = img_name
  ewin=open("../view_img.html", "view", 'height='+ScreenH+',width='+ScreenW+',left='+mLeft+',top='+mTop+',scrollbars=yes,resizable=yes,status=no,toolbar=no,location=no,directories=no');

}
//************************************************************************
/*function getMainMenu(mLang,mCity){
  document.write('<table width="670" border="0" align="center">');
  document.write('  <tr>');
  if (mLang == "a") {
    document.write('    <td><img src="../../images/amainmenu.gif" width="666" height="27" usemap="#menumap" border="0"></td>');
  } else {
    document.write('    <td><img src="../../images/emainmenu.gif" width="666" height="27" usemap="#menumap" border="0"></td>');
  }  
  document.write('  </tr>');
  document.write('</table>');
  if (mLang == "a") {
    document.write('<map name="menumap"> ');
    document.write('  <area shape="rect" coords="4,4,89,21"    href="JavaScript: open_link(\'../../misc/a/acontactus.htm\')">');
    document.write('  <area shape="rect" coords="129,3,212,21" href="aboutus.htm">');
    document.write('  <area shape="rect" coords="253,4,371,20" href="JavaScript: getListed(\'a\')">');
    document.write('  <area shape="rect" coords="409,4,538,21" href="menu00000601.htm">');
    document.write('  <area shape="rect" coords="573,4,660,19" href="../../amain'+mCity+'.htm">');
    document.write('</map>');
  } else {
    document.write('<map name="menumap"> ');
    document.write('<area shape="rect" coords="6,3,119,20" href="../../emain'+mCity+'.htm">');
    document.write('<area shape="rect" coords="149,3,258,19" href="menu00000601.htm">');
    document.write('<area shape="rect" coords="287,2,416,20" href="JavaScript: getListed(\'e\')">');
    document.write('<area shape="rect" coords="440,4,552,21" href="aboutus.htm">');
    document.write('<area shape="rect" coords="573,4,660,20" href="../../misc/e/econtactus.htm">');
    document.write('</map>');
  }  
}*/

function getMainMenu(mLang,mCity){
  var sPath = window.location.pathname;
  var sPage;
   if(sPath.lastIndexOf('/'))
    sPage = sPath.substring(sPath.lastIndexOf('/')+1);
	else
	sPage = sPath.substring(sPath.lastIndexOf('\\')+1);
  	if (mLang == "a")
	{
		document.write('<table width="790" border="0" align="center" cellpadding="0" cellspacing="0"><tr>');
		document.write('<td height="20" valign="middle" class="amenu"><a href="../../index.html">الرئيسية</a> | <a href="../../amain'+mCity+'.htm">الفهرس الرئيسي</a>| <a href="JavaScript: getListed(\'a\')">انضم إلينا</a> | <a href="../../misc/a/about.html">حول دليلك</a> | <a href="../../misc/a/contact.html">الاتصال بنا</a> | <a href="http://www.dalylak.com/getListed/index.php?act=ar">الدعم الفني</a></td>');
		document.write('<td align="left" class="emenu"><a href="../../'+mCity+'/e/'+sPage+'">English</a></td>');
		document.write('</tr>');
		document.write('</table>');
		
	} 
	 else
  	 {
		//new menu
		document.write('<table width="790" border="0" align="center" cellpadding="0" cellspacing="0" id="table9">');
		document.write(' <tr valign="bottom">');
		document.write(' <td height="20" class="menu"><a href="../../index.html">Home </a>| <a href="../../emain'+mCity+'.htm">Main Directory </a>|<a href="http://www.dalylak.com/getListed/index.php?act=en">Join dalYlak List</a> | <a href="../../misc/e/about.html"> About dalYlak</a> | <a href="JavaScript: openWebLink(\'../../misc/e/contact.html\');"> Contact Us</a> | <a href="javascript:support(\'e\')"> Support</a>');
		document.write('<div align="right"></div></td>');
		document.write('<td class="amenu"><div align="right"><a href="../../'+mCity+'/a/'+sPage+'"><strong>عربي</strong></a></div></td>');
		document.write('</tr>');
		document.write(' </table>');
		  
		//---------------------------------  
  }

}
//************************************************************************
function GetSearhType(){
	//default search in English
	var aaa=document.dalylakSearch.query.value;
	var bbb=aaa.charAt(0);
	var pat = /^[a-z]+$/i;
	if(pat.test(bbb)){
		document.dalylakSearch.id.value = "19033036";
	}else{
		document.dalylakSearch.id.value = "42127925";
	}
}
//************************************************************************
function getListed(mLang) {
  if (mLang == "a") { 
    var mURL = '../../misc/a/getlisted.htm'; 
  } 
  if (mLang == "e") { 
    var mURL = '../../misc/e/getlisted.htm'; 
  } 
  if (mLang == "am") { 
    var mURL = './misc/a/getlisted.htm'; 
  } 
  if (mLang == "em") { 
    var mURL = './misc/e/getlisted.htm'; 
  } 
  
  var ScreenH = 550;
  var ScreenW = 550;
  var mLeft = (screen.width - ScreenW) /2 ;
  var mTop = (screen.height - ScreenH) /2 ;
  ewin=open(mURL,'whatsnewwin', 'height='+ScreenH+',width='+ScreenW+',left='+mLeft+',top='+mTop+',scrollbars=yes,resizable=yes,status=no,toolbar=no,location=no,directories=no');
}
//********************************************************************************
function support(mLang) {
  if (mLang == "a") { 
    var mURL = '../../misc/a/support.htm'; 
  } 
  if (mLang == "e") { 
    var mURL = '../../misc/e/support.htm'; 
  } 
  if (mLang == "am") { 
    var mURL = './misc/a/support.htm'; 
  } 
  if (mLang == "em") { 
    var mURL = './misc/e/support.htm'; 
  } 

  var ScreenH = 620;
  var ScreenW = 550;
  var mLeft = (screen.width - ScreenW) /2 ;
  var mTop = (screen.height - ScreenH) /2 ;
  ewin=open(mURL,'whatsnewwin', 'height='+ScreenH+',width='+ScreenW+',left='+mLeft+',top='+mTop+',scrollbars=no,resizable=yes,status=no,toolbar=no,location=no,directories=no');
}
//************************************************************************
function openWebLink(URL) {
  var ScreenH = screen.height-180;
  var ScreenW = screen.width-40;
  var mLeft = (screen.width - ScreenW) /2 ;
  if (URL) {
    ewin=open(URL, '', 'height='+ScreenH+',width='+ScreenW+',menubar=yes,left=10,top=10,scrollbars=yes,resizable=yes,status=yes,toolbar=yes,location=yes,directories=no');
  }
}
//---------------------------------------------------
function openGermanyContact() {
  var ScreenH = 450;
  var ScreenW = 550;
  var mLeft = (screen.width - ScreenW) /2 ;
  var mTop = (screen.height - ScreenH) /2 ;
  var URL = "misc/e/germanycontact.htm";
  ewin=open(URL, '', 'height='+ScreenH+',width='+ScreenW+',width='+ScreenW+',left='+mLeft+',top='+mTop+',scrollbars=no,resizable=yes,status=no,toolbar=no,location=no,directories=no');
}
//---------------------------------------------------
function geTextSearch(mLang) {
  var browserName=navigator.appName; 
  if (browserName=="Microsoft Internet Explorer") {
	if (mLang=='a') {   
      document.write('<input name="query" type="text" class="ie-textinput" id="query" size="90">');   
	} else {
      document.write('<input name="query" type="text" class="ie-textinput" id="query" size="86">');   
	}
  } else {
	if (mLang=='a') {   
      document.write('<input name="query" type="text" class="ot-textinput" id="query" size="110">');   
	} else {
      document.write('<input name="query" type="text" class="ot-textinput" id="query" size="95">');   
	}
  }                 
}
//---------------------------------------------------
function mail_list(mLang) {
  if (mLang == "a") { 
    var mURL = 'http://www.dalylakmail.com/m_l/aindex.html'; 
  } 
  if (mLang == "e") { 
    var mURL = 'http://www.dalylakmail.com/m_l/eindex.html'; 
  } 

  var ScreenH = 620;
  var ScreenW = 550;
  var mLeft = (screen.width - ScreenW) /2 ;
  var mTop = (screen.height - ScreenH) /2 ;
  ewin=open(mURL,'whatsnewwin', 'height='+ScreenH+',width='+ScreenW+',left='+mLeft+',top='+mTop+',scrollbars=no,resizable=yes,status=no,toolbar=no,location=no,directories=no');
}
