function showEmailToFriend(ad_id,ad_cat){
	
	wValue = window.xShowModalDialog('/demo/include/popups/email_to_friend.cfm?ad_id=' + ad_id + '&ad_cat=' + ad_cat, '',"status:no;dialogWidth:450px;dialogHeight:500px;resizable:yes;scrollbars:no;center:yes");
	
}

function deleteAd(ad_id,ad_title,ad_status){
	if (confirm("Delete " + ad_title + "?"))
	{
		document.deleteAd.ad_to_delete.value= ad_id;
		document.deleteAd.ad_status.value=ad_status;
		document.deleteAd.submit();
	}
}

function removeFavorite(ad_id,ad_title){
	if (confirm("Are you sure you want to remove '" + ad_title + "' from your favorites list?"))
	{
		document.remFavFrm.ad_to_remove.value= ad_id;
		document.remFavFrm.submit();
	}
}

function addToFavorites(ad_id){
	document.favoritesFrm.favorite_ad.value = ad_id;
	document.favoritesFrm.submit();
}

function submitForm(aForm,  aTarget){
	aForm.action = aTarget;
	aForm.submit();
}

 function setsize() {
   var myWidth = 0, myHeight = 0;
 	
   if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
   } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
   } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = (document.body.clientWidth);
    myHeight = (document.body.clientHeight);
   }
   
   if (document.getElementById) {
    //Work with the elements using W3C DOM code
    //Netscape 6 specific code
    pre = 'document.getElementById("';
    post = '").style';  
   }
   else if (document.all) {
    //Work with the elements using DHTML DOM code
    //IE4+ specific code
    pre = 'document.all.';
    post = '.style';  
   }
   else if (document.layers) {
    //Work with the elements using LDOM- code
    //Netscape 4 specific code
    pre = 'document.';
    post = '';
   }

   var myDiv= eval(pre + "ad_list" + post).height ;
   var myDivtoSet= eval(pre + "contentLeft" + post) ;

   //myDiv.sub
   myDiv=myDiv.substring(0,myDiv.length-2);
   myDivtoSet.height = (parseInt(myDiv)+300)+'px';
	
	//alert(myDiv.length);
	
  }
 
 function xShowModalDialog( sURL, vArguments, sFeatures ) 
   { 
	dFeatures = 'dialogHeight: 450px; dialogWidth: 1049px; dialogTop: 646px; dialogLeft: 4px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;';//default features 
	modalWin = ""; 

    if (sURL==null||sURL=='') 
    { 
        alert ("Invalid URL input."); 
        return false; 
    } 
    if (vArguments==null||vArguments=='') 
    { 
        vArguments=''; 
    } 
    if (sFeatures==null||sFeatures=='') 
    { 
        sFeatures=dFeatures; 
    } 

    if (window.navigator.appVersion.indexOf("MSIE")!=-1) 
    { 
        var cReturnValue = window.showModalDialog ( sURL, vArguments, sFeatures ); 
        return cReturnValue; 
    } 
    sFeatures = sFeatures.replace(/ /gi,''); 
    aFeatures = sFeatures.split(";"); 
    sWinFeat = "directories=0,menubar=0,titlebar=0,toolbar=0,"; 

    for ( x in aFeatures ) 
    { 
        aTmp = aFeatures[x].split(":"); 
        sKey = aTmp[0].toLowerCase(); 
        sVal = aTmp[1]; 
        switch (sKey) 
        { 
            case "dialogheight": 
                sWinFeat += "height="+sVal+","; 
                pHeight = sVal; 
                break; 
            case "dialogwidth": 
                sWinFeat += "width="+sVal+","; 
                pWidth = sVal; 
                break; 
            case "dialogtop": 
                sWinFeat += "screenY="+sVal+","; 
                break; 
            case "dialogleft": 
                sWinFeat += "screenX="+sVal+","; 
                break; 
            case "resizable": 
                sWinFeat += "resizable="+sVal+","; 
                break; 
            case "status": 
                sWinFeat += "status="+sVal+","; 
                break; 
            case "center": 
                if ( sVal.toLowerCase() == "yes" ) 
                { 
					
                    	sWinFeat += "screenY="+((screen.availHeight-pHeight)/2)+","; 
                    	sWinFeat += "screenX="+((screen.availWidth-pWidth)/2)+",";
					
                }
                break; 
        } 
    } 
    modalWin=window.open(String(sURL),"",sWinFeat); 
    if (vArguments!=null&&vArguments!='') 
    { 
        modalWin.dialogArguments=vArguments; 
    } 
} 
