﻿var TRange = null

function findString(str) {

    
    if (parseInt(navigator.appVersion) < 4) return;
    var strFound;

    var srcObj = document.getElementById("srd");
    if (window.find) {

        // CODE FOR BROWSERS THAT SUPPORT window.find
        strFound = self.find(str);

        if (!strFound) {
            strFound = self.find(str, 0, 1)
            while (self.find(str, 0, 1)) { continue }
        }
    }
    else if (navigator.appName.indexOf("Microsoft") != -1) {

        // EXPLORER-SPECIFIC CODE < 9
        if (!str) return;
        if (TRange != null) {
            TRange.collapse(false)
            strFound = TRange.findText(str)
            if (strFound) TRange.select()
        }
        if (TRange == null || strFound == 0) {

            TRange = self.document.body.createTextRange()
            TRange.moveToElementText(srcObj);
            strFound = TRange.findText(str);
            if (strFound) TRange.select();
        }
    }
    else if (navigator.appName == "Opera") {

        return;
    }
    if (!strFound) {
        return;
    }
}

function RSS() {
    window.open("../../fa/RSS.aspx", "_self");
}

function Search() {
    var text = document.getElementById('ctl00_Txb_Search').value;
    if (text != null) {
        if (text != '') {
            window.open("?current=Finder&ValID=" + text + "&TypeID=5", "_self");
        }
    }

}

function ForceSingleValidation() {
    var lists = document.getElementsByTagName('*');
    var b = true;


    try {
        for (var i = 0; i < lists.length; i++) {
            if (lists[i].id.indexOf("arminaminiscriptrun") != -1) {
                var tmpRequiredValidator1 = document.getElementById(lists[i].id);
                ValidatorValidate(tmpRequiredValidator1);
                if (!tmpRequiredValidator1.isvalid) {
                    b = false;
                }


            }
        }

    } catch (e) {
        b = true;

    }

 



    if (b) {
        sendmail();
    }


}

function sendmail() {
    var fullname = document.getElementById('ctl00_plc_ctl00_txb_Name').value;
    var Email = document.getElementById('ctl00_plc_ctl00_txb_Email').value;
    var Phone = document.getElementById('ctl00_plc_ctl00_txb_phone').value;
    var Comment = document.getElementById('ctl00_plc_ctl00_txb_Comments').value;

    window.open("?current=Message&fullname=" + fullname + "&email=" + Email + "&phone=" + Phone + "&comment=" + Comment, "_self");
}

function keyPress(evt) {
    if (evt.which || evt.keyCode) {
        if ((evt.which == 13) || (evt.keyCode == 13)) {
            Search();
            return false;
        }
        return false;
    }
    return false;
} 


function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    if (results == null)
        return "";
    else
        findString(decodeURIComponent(results[1].replace(/\+/g, " ")));
}





function WriteFlash(flash, _width, _height) {
    document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + _width + "\" height=\"" + _height + "\">");
    document.writeln("  <param name=\"movie\" value=\"" + flash + "\" />");
    document.writeln("  <param name=\"quality\" value=\"high\" />");
    document.writeln("  <param name=\"wmode\" value=\"transparent\" />");
    document.writeln("  <embed src=\"" + flash + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + _width + "\" height=\"" + _height + "\" wmode=\"transparent\"></embed>");
    document.writeln("</object>");
}
function PlayFlash(flash, _width, _height) {
    document.writeln("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"" + _width + "\" height=\"" + _height + "\" id=\"fullscreen\" align=\"middle\">");
    document.writeln("  <param name=\"allowScriptAccess\" value=\"sameDomain\" />");
    document.writeln("  <param name=\"movie\" value=\"movieplayer.swf\" />");
    document.writeln("  <param name=\"quality\" value=\"high\" />");
		        document.writeln("  <param name=\"salign\" value=\"mc\" />");
		        document.writeln("  <param name=\"bgColor\" value=\"#ffffff\" />");
		        document.writeln("  <param NAME=FlashVars VALUE=\"vidpath=" + flash + "\" />");
		        document.writeln("  <embed src=\"movieplayer.swf\" FlashVars=\"vidpath=" + flash + "\" quality=\"high\" salign=\"mc\" bgcolor=\"#ffffff\" width=\"" + _width + "\" height=\"" + _height + "\" name=\"fullscreen\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />");
		        document.writeln("</object>");
		    }

		    function redirect() { location.href = "http://www.bazarsazan.com"; }
