﻿function openPopup(page,w,h,st) {
   window.open(page,'','scrollbars='+st+',width='+w+',height='+h+',status=yes,resizable=1,left=100,top=100,alwasRized');
}
function setDisplay(o,strDisp) {
    var display = '';
    if(o) {
        if(typeof(strDisp) == 'string') {
            display = strDisp;
        } else if(typeof(strDisp) == 'boolean') {
            display = strDisp ? 'inline' : 'none';
        } else if(typeof(strDisp) == 'number') {
            display = strDisp > 0 ? 'inline' : 'none';
        } else {
            display = strDisp;
        }
        o.style.display=display;
    }
}
function reverseDisplay(id){
    var d=document;
    if(d.getElementById(id)){
        var display = '';
        var o = d.getElementById(id);
        if(o.style.display=='inline') display='none';
        else if(o.style.display=='none') display='inline';
        else display='none';
        setDisplay(o,display);
    }
}
function setValue(o,val){
    if(o){
        o.value=val;
    }
}
function showMessenger() {
    var msgObj = document.getElementById('dvMessage');
    if(msgObj) {
        setDisplay(msgObj,'inline');
        var advObj = document.getElementById('dvAdvise');
        if(advObj) {
            setDisplay(advObj,'none');    
        }
        msgObj.style.top = "10px";
        msgObj.style.left = "10px";
    }
}
function hideMessenger() {
    var msgObj = document.getElementById('dvMessage');
    if(msgObj) {
        setDisplay(msgObj,'none');
    }
}
function showAdvice() {
    var advObj = document.getElementById('dvAdvise');
    if(advObj) {
        setDisplay(advObj,'inline');
        var msgObj = document.getElementById('dvMessage');
        if(msgObj) {
            setDisplay(msgObj,'none');    
        }
        advObj.style.top = "10px";
        advObj.style.left = "10px";
    }
}
function hideAdvice() {
    var advObj = document.getElementById('dvAdvise');
    if(advObj) {
        setDisplay(advObj,'none');
    }
}
function bookmarkIt() {
    hideMessenger();
    hideAdvice();
    var title = 'AutoClubTR';
    var url = document.location.href;
    if (window.sidebar) {
        window.sidebar.addPanel(title, url, "");
    } else if(window.opera && window.print) { 
        var elem = document.createElement('a');
        elem.setAttribute('href',url);
        elem.setAttribute('title',title);
        elem.setAttribute('rel','sidebar');
        elem.click();
    } else if(document.all) {
        window.external.AddFavorite(url, title);
    }
}
var embedVideo;
function stopPlayers(){
    try {
        var embeds = document.getElementsByTagName('embed');
        for(i = 0; i < embeds.length; i++) {
            embeds[i].sendEvent("STOP");
            //setTimeout("player.sendEvent('STOP')", 0);
        }
    }
    catch(ex){;}
}
function MarkAsRead(id){
    if(id){
        var objXmlHttp = createXMLHTTP();
	    if(objXmlHttp) {
	        var url = 'http://'+document.location.host+'/xmlhttp/markAsRead.aspx?id='+id;
		    objXmlHttp.open("GET",url,true);
		    objXmlHttp.onreadystatechange=function() {
			    if(objXmlHttp.readyState==4) {
			        objXmlHttp=null;
			    }						
		    }; objXmlHttp.send();
	    }
    }
}
function createXMLHTTP() {
	var retval=null;
	try { retval=new ActiveXObject("Msxml2.XMLHTTP"); }
	catch(e) {
		try { retval=new ActiveXObject("Microsoft.XMLHTTP"); } 
		catch(oc) { retval=null; }
	}
	if(!retval && typeof XMLHttpRequest != "undefined") {
		retval=new XMLHttpRequest();
	}
	return retval;
}	
function ACFL(width,height,src,id){
     document.write(
        '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"\n\
         width="'+width+'" height="'+height+'" id="'+id+'" align="middle">\n\
        <param name="allowScriptAccess" value="sameDomain" />\n\
        <param name="movie" value="'+src+'" />\n\
        <param name="quality" value="high" />\n\
        <param name="bgcolor" value="#000000" />\n\
        <param name="wmode" value="window" />\n\
        <embed src="'+src+'" quality="high" bgcolor="#000000" width="'+width+'"\n\
         height="'+height+'" name="multi_movie" align="middle" allowscriptaccess="sameDomain"\n\
         type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"\n\
         wmode="window" />\n\
        </object>');
}
